MenuDesigner: Jump also to an existing OnClick handler. Fix crash when changing projects.

git-svn-id: trunk@52260 -
This commit is contained in:
juha 2016-04-29 14:44:51 +00:00
parent e49084d8b3
commit a483fc5371
2 changed files with 8 additions and 5 deletions

View File

@ -2028,8 +2028,10 @@ begin
existingSI.RealItem.Parent.Insert(idx, newMI); existingSI.RealItem.Parent.Insert(idx, newMI);
TShadowItem.CreateWithBoxAndItem(FShadowMenu, existingSI.ParentBox, newMI); TShadowItem.CreateWithBoxAndItem(FShadowMenu, existingSI.ParentBox, newMI);
FShadowMenu.UpdateBoxLocationsAndSizes; FShadowMenu.UpdateBoxLocationsAndSizes;
FShadowMenu.FDesigner.FGui.AddingItem := True;
GlobalDesignHook.PersistentAdded(newMI, not isSeparator); GlobalDesignHook.PersistentAdded(newMI, not isSeparator);
GlobalDesignHook.Modified(newMI); //GlobalDesignHook.Modified(newMI);
FShadowMenu.FDesigner.FGui.AddingItem := False;
if not isSeparator then if not isSeparator then
FShadowMenu.FDesigner.FGui.UpdateStatistics; FShadowMenu.FDesigner.FGui.UpdateStatistics;
FShadowMenu.UpdateActionsEnabledness; FShadowMenu.UpdateActionsEnabledness;
@ -2220,7 +2222,6 @@ end;
procedure TShadowItem.DblClick; procedure TShadowItem.DblClick;
begin begin
inherited DblClick; inherited DblClick;
if not FShadowMenu.OnClickIsAssigned(FRealItem) then
FShadowMenu.AddOnClick(nil); FShadowMenu.AddOnClick(nil);
end; end;

View File

@ -69,6 +69,7 @@ type
FAcceleratorMenuItemsCount: integer; FAcceleratorMenuItemsCount: integer;
FCaptionedItemsCount: integer; FCaptionedItemsCount: integer;
FDeepestNestingLevel: integer; FDeepestNestingLevel: integer;
FAddingItem: Boolean;
FGUIEnabled: boolean; FGUIEnabled: boolean;
FIconsCount: integer; FIconsCount: integer;
FUpdateCount: integer; FUpdateCount: integer;
@ -102,6 +103,7 @@ type
aShadowBox: TShadowBoxBase; aPropEditHook: TPropertyEditorHook); aShadowBox: TShadowBoxBase; aPropEditHook: TPropertyEditorHook);
//property EditedMenu: TMenu read FEditedMenu; //property EditedMenu: TMenu read FEditedMenu;
//property AcceleratorMenuItemsCount: integer read FAcceleratorMenuItemsCount; //property AcceleratorMenuItemsCount: integer read FAcceleratorMenuItemsCount;
property AddingItem: Boolean read FAddingItem write FAddingItem;
end; end;
TRadioIconGroup = class; TRadioIconGroup = class;
@ -289,8 +291,8 @@ begin
SetMenu(mnu, mi); SetMenu(mnu, mi);
end; end;
end end
else else if not AddingItem then
DebugLn('TMenuDesignerForm.OnDesignerSetSelection: Is SetMenu(nil, nil) ever needed here?'); SetMenu(nil, nil);
end; end;
procedure TMenuDesignerForm.ShowPopupAssignmentsInfo; procedure TMenuDesignerForm.ShowPopupAssignmentsInfo;