Reputation: 1117
I have a simple program (in delphi 7) on its main form is a button. When I click the button on the main form, I will open the second form. When I close the second form how can I prevent running main form OnActivate event? (except this code: MainForm.OnActivate = nil)
thanks
Upvotes: 1
Views: 1108
Reputation:
easiest possibility
MainForm.OnActivate := NIL;
Form2.ShowModal;
MainForm.OnActivate := MainFormOnActivate;
using something else can break future compatibility in Delphi...
Upvotes: 2
Reputation: 26830
A nice shorthand for temporarily disabling an event using GpStuff (BSD License):
uses
GpStuff;
with DisableHandler(@@MainForm.OnActivate) do
Form2.ShowModal;
Upvotes: 5