prevent running main form OnActivate event
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
A nice shorthand for temporarily disabling an event using GpStuff (BSD License):
uses
GpStuff;
with DisableHandler(@@MainForm.OnActivate) do
Form2.ShowModal;
easiest possibility
MainForm.OnActivate := NIL;
Form2.ShowModal;
MainForm.OnActivate := MainFormOnActivate;
using something else can break future compatibility in Delphi...
精彩评论