自定了一加在FORM上的管理组件:
重载了组件的Notification过程: procedure TFormLed.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
if fAutoAuthorized then
case Operation of
opInsert:
if (AComponent is TCustomForm) and
(AComponent <> owner) then
begin
fOldOnFormCreate := TForm(AComponent).OnCreate;
TForm(AComponent).OnCreate := OnFormCreate;
end;
end;
end;
现将组件放在FORM1中,在一个button的onclick事件中
oForm2 := Form2.Create(self); 如此,Form2.OnCreate事件将被 FomrLed组件的OnFormCreate
替换,成功达到效果。 现在问题来了,当我在FORM2的OnCreate事件响应过程Form2OnCreate中写入代码时,Form2OnCreate最终将
FormLed.OnFormCreate覆盖,FormLed.OnFormCreate将不再能够执行得到。
请问各位高手,有什么办法可以解决;
重载了组件的Notification过程: procedure TFormLed.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited Notification(AComponent, Operation);
if fAutoAuthorized then
case Operation of
opInsert:
if (AComponent is TCustomForm) and
(AComponent <> owner) then
begin
fOldOnFormCreate := TForm(AComponent).OnCreate;
TForm(AComponent).OnCreate := OnFormCreate;
end;
end;
end;
现将组件放在FORM1中,在一个button的onclick事件中
oForm2 := Form2.Create(self); 如此,Form2.OnCreate事件将被 FomrLed组件的OnFormCreate
替换,成功达到效果。 现在问题来了,当我在FORM2的OnCreate事件响应过程Form2OnCreate中写入代码时,Form2OnCreate最终将
FormLed.OnFormCreate覆盖,FormLed.OnFormCreate将不再能够执行得到。
请问各位高手,有什么办法可以解决;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货