fix accelerator handling firing too quickly, better WM_CHAR has-been-handled heuristic

check for focusability of label.focuscontrol

git-svn-id: trunk@7111 -
This commit is contained in:
micha 2005-04-28 10:05:29 +00:00
parent 553b2f9e2a
commit 96e2620223
2 changed files with 15 additions and 3 deletions

View File

@ -185,7 +185,7 @@ begin
if not FShowAccelChar then exit;
if FFocusControl = nil then exit;
if IsAccel(Message.CharCode, Caption) then
if IsAccel(Message.CharCode, Caption) and FFocusControl.CanFocus then
begin
Result := true;
FFocusControl.SetFocus;
@ -266,6 +266,10 @@ end;
{
$Log$
Revision 1.31 2005/04/28 10:05:29 micha
fix accelerator handling firing too quickly, better WM_CHAR has-been-handled heuristic
check for focusability of label.focuscontrol
Revision 1.30 2005/04/27 12:37:28 micha
implement/fix button/label shortcut accelchar handling

View File

@ -1371,9 +1371,12 @@ Begin
WM_CHAR, WM_KEYDOWN, WM_KEYUP,
WM_SYSCHAR, WM_SYSKEYDOWN, WM_SYSKEYUP:
begin
PLMsg^.Result := 0;
case Msg of
WM_CHAR:
begin
// if want chars, then handled already
PLMsg^.Result := CallDefaultWindowProc(Window, WM_GETDLGCODE, 0, 0) and DLGC_WANTCHARS;
LMChar.CharCode := Word(WParam);
LMChar.Msg := LM_CHAR;
end;
@ -1405,9 +1408,10 @@ Begin
end;
// we cannot tell for sure windows didn't want the key
// for WM_CHAR check WM_GETDLGCODE/DLGC_WANTCHARS
// winapi too inconsistent about return value
PLMsg^.Result := 0;
DeliverMessage(lWinControl, PLMsg^);
if PLMsg^.Result = 0 then
DeliverMessage(lWinControl, PLMsg^);
// handle Ctrl-A for edit controls
if (PLMsg^.Result = 0) and (Msg = WM_KEYDOWN) and (WParam = Ord('A'))
@ -1548,6 +1552,10 @@ end;
{
$Log$
Revision 1.202 2005/04/28 10:05:29 micha
fix accelerator handling firing too quickly, better WM_CHAR has-been-handled heuristic
check for focusability of label.focuscontrol
Revision 1.201 2005/04/20 14:08:38 vincents
fixed SpinEdit.Visible and SpinEdit.Enabled