From cbb072522289a3ab12e158a291c4c228d2638cf5 Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Thu, 22 Dec 2011 16:43:37 +0000 Subject: [PATCH] Fixes focusing into intf controls git-svn-id: trunk@34364 - --- .../customdrawn/customdrawnprivate.pas | 2 ++ .../customdrawn/customdrawnproc.pas | 4 ++- lcl/interfaces/customdrawn/wincallback.inc | 26 ------------------- 3 files changed, 5 insertions(+), 27 deletions(-) diff --git a/lcl/interfaces/customdrawn/customdrawnprivate.pas b/lcl/interfaces/customdrawn/customdrawnprivate.pas index 6af0d78f86..fe1afea5eb 100644 --- a/lcl/interfaces/customdrawn/customdrawnprivate.pas +++ b/lcl/interfaces/customdrawn/customdrawnprivate.pas @@ -121,6 +121,7 @@ begin lTarget := FindControlWhichReceivedEvent(AWindowHandle.LCLForm, AWindowHandle.Children, x, y); AWindowHandle.LastMouseDownControl := lTarget; AWindowHandle.FocusedControl := lTarget; + AWindowHandle.FocusedIntfControl := nil; lEventPos := FormPosToControlPos(lTarget, x, y); LCLSendMouseDownMsg(lTarget, lEventPos.x, lEventPos.y, Button, ShiftState); @@ -129,6 +130,7 @@ begin if IsIntfControl(lTarget) then begin lIntfTarget := lTarget; + AWindowHandle.FocusedIntfControl := lTarget; lTarget := lTarget.Parent; LCLSendMouseDownMsg(lTarget, lEventPos.x, lEventPos.y, Button, ShiftState); diff --git a/lcl/interfaces/customdrawn/customdrawnproc.pas b/lcl/interfaces/customdrawn/customdrawnproc.pas index a7ee2cce77..863db4dbcc 100644 --- a/lcl/interfaces/customdrawn/customdrawnproc.pas +++ b/lcl/interfaces/customdrawn/customdrawnproc.pas @@ -51,6 +51,7 @@ type // LastMouseDownControl: TWinControl; // Stores the control which should receive the next MouseUp FocusedControl: TWinControl; // The control focused in the form + FocusedIntfControl: TWinControl; // The intf control focused in the form LayoutAutoAdjusted: Boolean; // Indicates if the form layout was already auto-adjusted once // Counter to keep track of when we requested Invalidate // Some systems like X11 and Win32 will keep sending unnecessary paint messages @@ -717,7 +718,8 @@ end; function TCDForm.GetFocusedControl: TWinControl; begin - if FocusedControl <> nil then Result := FocusedControl + if FocusedIntfControl <> nil then Result := FocusedIntfControl + else if FocusedControl <> nil then Result := FocusedControl else Result := LCLForm; end; diff --git a/lcl/interfaces/customdrawn/wincallback.inc b/lcl/interfaces/customdrawn/wincallback.inc index be4f571a2b..eb71088861 100644 --- a/lcl/interfaces/customdrawn/wincallback.inc +++ b/lcl/interfaces/customdrawn/wincallback.inc @@ -737,29 +737,6 @@ begin CallbackMouseMove(WindowInfo, XPos, YPos, WParamShiftState); Result := 1; Exit; - {NotifyUserInput := True; - PLMsg:=@LMMouseMove; - with LMMouseMove Do - begin - Msg := LM_MOUSEMOVE; - XPos := SmallInt(Lo(LParam)); - YPos := SmallInt(Hi(LParam)); - Keys := WParam; - // check if this is a spurious WM_MOUSEMOVE message, pos not actually changed - if (XPos = WindowInfo.MouseX) and (YPos = WindowInfo.MouseY) then - begin - // do not fire message after all (position not changed) - Msg := LM_NULL; - NotifyUserInput := false; - end else - if (WindowInfo.MouseX <> DefaultWindowInfo.MouseX) or - (WindowInfo.MouseY <> DefaultWindowInfo.MouseY) then - begin - // position changed, update window info - WindowInfo.MouseX := XPos; - WindowInfo.MouseY := YPos; - end; - end;} end; WM_MOUSEWHEEL: begin @@ -827,9 +804,6 @@ begin end; WM_PAINT: begin - {$IFDEF DEBUG_WINCE_LABELS} - DebugLn('[WM_PAINT]'); - {$ENDIF} SendPaintMessage(HDC(WParam)); // SendPaintMessage sets winprocess to false end;