Menu designer: Add/remove OnDesignerSetSelection handler when window is shown/hidden. Issue #30712, inspired by a patch from Michl.

git-svn-id: trunk@53087 -
This commit is contained in:
juha 2016-10-09 20:13:37 +00:00
parent 738cf3bc30
commit 61e72dabdc
2 changed files with 14 additions and 1 deletions

View File

@ -11,6 +11,8 @@ object MenuDesignerForm: TMenuDesignerForm
KeyPreview = True
OnCreate = FormCreate
OnDestroy = FormDestroy
OnHide = FormHide
OnShow = FormShow
Position = poScreenCenter
ShowHint = True
LCLVersion = '1.7'

View File

@ -62,6 +62,8 @@ type
SubmenuGroupBox: TGroupBox;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormHide(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure HelpButtonClick(Sender: TObject);
strict private
FDesigner: TMenuDesignerBase;
@ -244,7 +246,6 @@ begin
LoadFixedButtonGlyphs;
LoadVariableButtonGlyphs(True);
KeyPreview:=True;
GlobalDesignHook.AddHandlerSetSelection(@OnDesignerSetSelection);
InitializeStatisticVars;
SetupPopupAssignmentsDisplay;
end;
@ -254,6 +255,16 @@ begin
FreeAndNil(FPopupAssignments);
end;
procedure TMenuDesignerForm.FormShow(Sender: TObject);
begin
GlobalDesignHook.AddHandlerSetSelection(@OnDesignerSetSelection);
end;
procedure TMenuDesignerForm.FormHide(Sender: TObject);
begin
GlobalDesignHook.RemoveHandlerSetSelection(@OnDesignerSetSelection);
end;
procedure TMenuDesignerForm.HelpButtonClick(Sender: TObject);
const
helpPath = 'http://wiki.lazarus.freepascal.org/IDE_Window:_Menu_Editor';