开发者

prevent running main form OnActivate event

开发者 https://www.devze.com 2023-02-03 01:33 出处:网络
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.

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

精彩评论

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