Use the sender parameters

xiaoxiao2021-03-06  40

In an event handler, the Sender parameter indicates which component received the event and therefore called the handler. Sometimes it is useful to have several components share an event handler that behaves differently depending on which component calls it. You can do this by using the Sender Parameter in an information. for example............................ ...

In an event handle, the Sender parameter refers to which component accepts the event and therefore calls the event. Sometimes a few components share the same event handle is useful, and the event produces a different behavior is determined by the components that call it. To do this, you can use the sender parameter to IF ... then ... Else statement. The following code demonstrates the title of the program to the title of the specified dialog when the ONClick event occurs when the Button1 button occurs. Procedure Tmainform.Button1Click (Sender: TOBJECT); Beginif Sender = Button1 Then AboutBox.caption: = 'About' Application.title else AboutBox.caption: = ''; AboutBox.ShowModal; End;

转载请注明原文地址:https://www.9cbs.com/read-62786.html

New Post(0)