Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to call events on events

Status
Not open for further replies.

JannethOfelia

Programmer
Jul 2, 2014
1
MX
Hi, Someone could help me help how to call an event inside another event in c + +?
Thanks
 
Just call it like you would any other function:
Code:
TForm1::Button1Click(TObject *Sender)
{
  Application->MessageBox("Button1 Handler!", NULL, MB_Ok);
};

TForm1::Button2Click(TObject *Sender)
{
  Button1Click(Sender);  //calls Button1's handler
};

Or, if you want to call it from the event property value:
Code:
TForm1::Button2Click(TObject *SEnder)
{
  if (this->Button1->OnClick)
  this->Button1->OnClick(Sender); // Calls Button1's OnClick Event through it's event property if it is assigned
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top