开发者

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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜