From dcb5b021b548f84830c77094ccb1da4d08a91f41 Mon Sep 17 00:00:00 2001 From: bart <9132501-flyingsheep@users.noreply.gitlab.com> Date: Tue, 4 Nov 2014 15:48:22 +0000 Subject: [PATCH] THeaderControl: properly restore Cursor after we internally changed it. Issue #0026968. git-svn-id: trunk@46748 - --- lcl/comctrls.pp | 2 ++ lcl/include/headercontrol.inc | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lcl/comctrls.pp b/lcl/comctrls.pp index db5a938baa..0760e7eddd 100644 --- a/lcl/comctrls.pp +++ b/lcl/comctrls.pp @@ -3661,6 +3661,7 @@ type FEndDragSectionIndex: longint; FSelectedSection: longint; FMouseInControl: Boolean; + FSavedCursor: TCursor; FOnSectionClick: TCustomSectionNotifyEvent; FOnSectionResize: TCustomSectionNotifyEvent; @@ -3677,6 +3678,7 @@ type protected function CreateSection: THeaderSection; virtual; function CreateSections: THeaderSections; virtual; + procedure Loaded; override; procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure SectionClick(Section: THeaderSection); virtual; procedure SectionResize(Section: THeaderSection); virtual; diff --git a/lcl/include/headercontrol.inc b/lcl/include/headercontrol.inc index 3b4b155db4..4bd45e9274 100644 --- a/lcl/include/headercontrol.inc +++ b/lcl/include/headercontrol.inc @@ -74,6 +74,15 @@ begin Result := THeaderSections.Create(Self); end; + + +procedure TCustomHeaderControl.Loaded; +begin + inherited Loaded; + FSavedCursor := Cursor; + //debugln('TCustomHeaderControl.Loaded: Setting FSavedCursor to ',DbgS(FSavedCursor)); +end; + constructor TCustomHeaderControl.Create(AOwner: TComponent); begin inherited Create(AOwner); @@ -177,6 +186,8 @@ begin inherited MouseEnter; if not (csDesigning in ComponentState) then begin + FSavedCursor := Cursor; + //debugln('TCustomHeaderControl.MouseEnter: setting FSavedCursor to ',dbgS(FSavedCursor)); FMouseInControl := True; UpdateState; end; @@ -267,7 +278,7 @@ begin (GetSectionAt(Point(X - HeaderBorderSize, Y))<>GetSectionAt(Point(X + HeaderBorderSize, Y))) then Cursor:=crSizeE else - Cursor:=crDefault; + Cursor:=FSavedCursor; UpdateState; end; end;