Link to home
Start Free TrialLog in
Avatar of philtwo
philtwo

asked on

How to determin which component triggered an event?

I am working on my first windows project in Borland C++ and I can't seem to figure this out:

I need to have an array of components, or some way of quickly stepping through each one so I can duplicate the values, I chose an array.

I define my componenets:

TCheckBox ListBox[MAX_ITEMS];
 
for (count=0;count<MAX_ITEMS;count++) {
     ListBox[count] = new TCheckBox(this);
     ListBox[count].Top = 35;
     ListBox[count].Tag = count;
     // other properties and stuff ...
     ListBox[count].OnClick = &EntryDuplicate;
}

My question is how can I access the properties of the
TCheckBox componenet that triggered the event from the event?

Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of thienpnguyen
thienpnguyen

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of thienpnguyen
thienpnguyen

Other way,

void __fastcall TForm1::EntryDuplicate(TObject *Sender)
{
   TListBox *listbox = dynamic_cast<TListBox*>( Sender );
   if( listbox != NULL )
   {
       listbox->Top = 10;
        //....
   }

}
Avatar of philtwo

ASKER

Asbolute life saver - thanks alot!!