|Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread|
|Messages 1 to 3 of 3 total|
|How to clear Event Method at run-time?|
|Fri, Aug 12 2016 7:59 PM||Permanent Link|
How can a components Event Method be set to nothing?
Basically, the opposite of assigning a method at run-time via the OnClick = OnClickHandler.
OnClick := nil // does not work.
|Sat, Aug 13 2016 4:15 AM||Permanent Link|
They all work as expected.
At what stage you are trying to set OnClick.
May be you are doing it before the component loading stage so that your assignments are overridden.
procedure TForm1.NewHandlerForClick(Sender: TObject);
procedure TForm1.Button1Click(Sender: TObject);
procedure TForm1.Button2Click(Sender: TObject);
Button1.OnClick := nil;
procedure TForm1.Button3Click(Sender: TObject);
Button1.OnClick := NewHandlerForClick;
|Sat, Aug 13 2016 6:20 AM||Permanent Link|
<< They all work as expected. >>
Yes, it works. My error was I forgot to chamne the parameter of the function from a TControl to a TForm. As the event method (OnAnimationComplete) does not exist for a TControl the error occured.