From 085918972f2a60890d36a0d7679a8a5255db018c Mon Sep 17 00:00:00 2001 From: paul Date: Thu, 22 Jul 2010 08:20:10 +0000 Subject: [PATCH] lcl: don't check shortcuts on disabled forms git-svn-id: trunk@26774 - --- lcl/include/application.inc | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lcl/include/application.inc b/lcl/include/application.inc index 6c76a0ed95..6607034711 100644 --- a/lcl/include/application.inc +++ b/lcl/include/application.inc @@ -1962,26 +1962,27 @@ begin begin FOnShortcut(Message, Result); if Result then - exit; + Exit; end; // next: if there is a modal form, let it handle the short cut - ModalForm:=Screen.GetCurrentModalForm; - if ModalForm<>nil then begin - Result := ModalForm.IsShortcut(Message); - end else begin - // there is no modal form - - // let the current focused form handle the shortcut - if Screen.ActiveCustomForm<>nil then begin + ModalForm := Screen.GetCurrentModalForm; + if Assigned(ModalForm) and IsWindowEnabled(ModalForm.Handle) then + Result := ModalForm.IsShortcut(Message) + else + begin + // no modal form - let the current focused form handle the shortcut + if Assigned(Screen.ActiveCustomForm) and IsWindowEnabled(Screen.ActiveCustomForm.Handle) then + begin Result := Screen.ActiveCustomForm.IsShortcut(Message); - if Result then exit; + if Result then Exit; end; // let the main form handle the shortcut - if (MainForm<>nil) and (Screen.ActiveCustomForm<>MainForm) then begin + if Assigned(MainForm) and (Screen.ActiveCustomForm <> MainForm) and IsWindowEnabled(MainForm.Handle) then + begin Result := FMainForm.IsShortcut(Message); - if Result then exit; + if Result then Exit; end; end; end;