lcl: move shortcut handling from after interface to before interface (bug #0016990)

git-svn-id: trunk@26833 -
This commit is contained in:
paul 2010-07-26 04:54:10 +00:00
parent f09d8860b7
commit 013200586a
2 changed files with 18 additions and 20 deletions

View File

@ -5577,6 +5577,24 @@ begin
KeyDownBeforeInterface(CharCode, ShiftState);
if CharCode = VK_UNKNOWN then Exit;
end;
// check the shortcuts
// check popup menu
if Assigned(FPopupMenu) and FPopupMenu.IsShortCut(Message) then
Exit;
// let each parent form handle shortcuts
AParent := Parent;
while Assigned(AParent) do
begin
if (AParent is TCustomForm) and TCustomForm(AParent).IsShortcut(Message) then
Exit;
AParent := AParent.Parent;
end;
// let application handle shortcut
if Assigned(Application) and Application.IsShortcut(Message) then
Exit;
end;
Result := False;
@ -5611,29 +5629,11 @@ end;
function TWinControl.DoRemainingKeyDown(var Message: TLMKeyDown): Boolean;
var
ShiftState: TShiftState;
AParent: TWinControl;
begin
Result := True;
ShiftState := KeyDataToShiftState(Message.KeyData);
// check popup menu
if Assigned(FPopupMenu) and FPopupMenu.IsShortCut(Message) then
Exit;
// let each parent form handle shortcuts
AParent := Parent;
while Assigned(AParent) do
begin
if (AParent is TCustomForm) and TCustomForm(AParent).IsShortcut(Message) then
Exit;
AParent := AParent.Parent;
end;
// let application handle shortcut
if Assigned(Application) and Application.IsShortcut(Message) then
Exit;
// let parent(s) handle key from child key
if Assigned(Parent) and Parent.ChildKey(Message) then
Exit;

View File

@ -377,8 +377,6 @@ begin
PostQuitMessage(AMessage.wParam);
break;
end;
// todo: maybe check the keyboard messages here before their applying to window
// to prevent system keys mix with LCL shortcuts?
TranslateMessage(@AMessage);
{$IFDEF WindowsUnicodeSupport}
if UnicodeEnabledOS then