Problem/Question/Abstract:
Disabling an event handler once it has executed once
Answer:
Have you ever wanted to keep an event from firing once it has executed once? Simply set the event handler method to nil in the body of the method. For instance, let's say you want to disable an OnClick for a button once the user has pressed it. Here's the code to do that:
procedure Button1OnClick;
begin
Button1.OnClick := nil;
end;
Nincsenek megjegyzések:
Megjegyzés küldése