delphi - TComponet / any other Superclass and its child item detection -


I have popup menu control on the form (grr, I most likely have it dynamic - hate device static) . It has got items with Submenu Submenu has three menu items (TMEIITIM class).

I will have to check with the sender param and I..then if the process has been called by item or submenu items with any submenu.

I tried different vraiations with typecasting and superclass operations but no luck. I think it is possible to do something like this:

  if FindControl (MenuItemWithSubMenu.Handle) = TControl (Sender as TComponent) Then parents ...  

But of course, with the right typecasting and command

Any idea was appreciated.

Additional information by community request:

The code looks like ITSF (if I want to support through a component number):

  Process TForm1.xClick (Sender: Tubect); // If the process that is linked to PopupActionBar1 starts with item ((TComponent (Sender) .name = 'Unloadresources1') or // PopupActionBar1.Items [3] (TComponent (Sender) .name = 'VKPCache11') or // PopupActionBar1 heme [3]. [0] (TComponent (sender) .name = 'VKPKach 21') or // popup actionbars 1. item [3]. [1] (TCMAPent (sender) .name = 'Olketa 31 ') Or / / popupActionBar 1.itm [3]. [2] (ExtraDavell = 2)) and (PopupAxpressBar 1.Imament [3]. Caption =' Delete VKP cache ') starts. End; End; The problem is that this is the method of weak approach and the programming user wants to add / drag 'nDrop / insert or require runtime or extra coding. Program like this: I will do a light work on my own site - know what to call and when :)  

On (static) form 1 (static) popup action bar 1 There are four items in it, the next item contains submenu - with three items.

In the fourth item with submenu items, both (PopupActionless 1.Time [3]) and three submenu items (PopupActionShatter 1.Time [3]. [0. 2] Setting Up OnClick Event Handlers In this process, the statement is set up. The statement is written above.

Work - eveluating the sender parameter and using its OOP capabilities - Check that the process has been called from PopupAction 1. [3] menu items or submenu content (PopupActionlessBit 1.Time [3]. [0] or PopupAxchangeBar 1.Items [3]. [1] or PopupActionbar 1.Items [3] Heatum [2]).

I have Tried various syntax ... tried typecasting manipulation with TCTCL, twin control, TComponent .. (TOBject has no use, there is no parent in it (excl. OLE) ..

you do not need to find items It is already sender, you can do it

  process TForm1.MyItem1Click (sender: tubabies), if started, sender = MyItem1 [...] and if sender = MyItem2 then  

I usually use the tag property to separate MenuItem which turns the handler on, not elegant, but works.

  Process TForm1.Item1Click (Sender: Tubbed); Case of Startup TMenuItem (Sender). Tag of 0: [..]; 1: [..]; [..]  

In order to point out the same handler, remember to set the OnClick event of all menu items. I do not remember anything like this unless I have any effect by clicking on someone.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -