lcl: when menu shortcut is executed perform action update and click starting from the parent to node (this is delphi compatible behavior). Fixes issue #0015427

git-svn-id: trunk@23311 -
This commit is contained in:
paul 2009-12-28 10:48:40 +00:00
parent 8f7b3f6e4b
commit a35c06eeb7

View File

@ -246,6 +246,19 @@ begin
end;
function TMenu.IsShortcut(var Message: TLMKey): boolean;
procedure HandleItem(Item: TMenuItem);
begin
if Item = nil then
Exit;
HandleItem(Item.Parent);
if Item.Enabled then
begin
Item.InitiateActions;
Item.Click;
end;
end;
var
Item: TMenuItem;
Shortcut: TShortcut;
@ -258,9 +271,8 @@ begin
//DebugLn(['TMenu.IsShortcut ',dbgsName(Self),' Result=',Result,' Message.CharCode=',Message.CharCode,' ShiftState=',dbgs(ShiftState)]);
if Result then
begin
FShortcutHandled := true;
Item.InitiateActions;
Item.Click;
FShortcutHandled := True;
HandleItem(Item);
Result := FShortcutHandled;
end;
end;