You cannot obtain this information by fair means. The solution is to use two separate top-level event handlers, which, in turn, can call another method, passing a parameter that determines which event is being processed.
type TButtonEventType = (beOnClick, beOnExit); procedure TMyForm.ButtonClick(Sender: TObject); begin HandleButtenEvent(beOnClick); end; procedure TMyForm.ButtonExit(Sender: TObject); begin HandleButtenEvent(beOnExit); end; procedure TMyForm.HandleButtonEvent(EventType: TButtonEventType); begin //use EventType to decide how to handle this end;
source share