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);
TShadowItem.CreateWithBoxAndItem(FShadowMenu, existingSI.ParentBox, newMI);
FShadowMenu.UpdateBoxLocationsAndSizes;
FShadowMenu.FDesigner.FGui.AddingItem := True;
GlobalDesignHook.PersistentAdded(newMI, not isSeparator);
GlobalDesignHook.Modified(newMI);
//GlobalDesignHook.Modified(newMI);
FShadowMenu.FDesigner.FGui.AddingItem := False;
if not isSeparator then
FShadowMenu.FDesigner.FGui.UpdateStatistics;
FShadowMenu.UpdateActionsEnabledness;
@ -2220,8 +2222,7 @@ end;
procedure TShadowItem.DblClick;
begin
inherited DblClick;
if not FShadowMenu.OnClickIsAssigned(FRealItem) then
FShadowMenu.AddOnClick(nil);
FShadowMenu.AddOnClick(nil);
end;
function TShadowItem.GetHeight: integer;

View File

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