张志峰的博客

水滴石川,积少成多。

导航

delphi TOnFormVisibleChangeEvent 事件应用

Posted on 2017-08-31 13:47  ╰★张志峰★╮  阅读(372)  评论(0编辑  收藏  举报

TGQIFileMgrForm = class(TForm)

 

定义

property OnVisibleChange: TOnFormVisibleChangeEvent read FOnVisibleChange write FOnVisibleChange;

 

在另一个窗体中  把上面的窗体定义成自己变量

FCADFileMgrFrm: TGQIFileMgrForm;

创建

  

// 创建图纸管理窗体
FCADFileMgrFrm := TGQIFileMgrForm.Create(Self, FProject, FSceneViewer, FCADLayerFrm.tvCADLayersTreeView);
FCADFileMgrFrm.Visible := False;
FCADFileMgrFrm.OnVisibleChange := DoOnCADFileMgrFrmVisibleChange;
FCADFileMgrFrm.OnExecuteCommand := Execute;
FCADFileMgrFrm.gvdFloorMapinfoGrid.OnDblClick := FloorChange;
UiService.FormCenter.RegisterForm(FCADFileMgrFrm, AModuleID);

 

 

在那个窗体中实现方法 DoOnCADFileMgrFrmVisibleChange



procedure TGAEAModelInputForm.DoOnCADFileMgrFrmVisibleChange;
begin
if FCADFileMgrFrm.GettsOriginalImageListVisible then
FCommandEnabledController.RefreshActionEnabled;
end;

 

这样 TGQIFileMgrForm 的定义的事件和 TGAEAModelInputForm就关联起来了