mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 02:39:15 +02:00
LCL: Isolate setting the control's position from TControlScrollBar.SetPosition. A half-baked attempt to fix #29067.
git-svn-id: trunk@50479 -
This commit is contained in:
parent
c9f8dd26db
commit
8c4e943410
@ -84,7 +84,6 @@ type
|
|||||||
FIncrement: TScrollBarInc;
|
FIncrement: TScrollBarInc;
|
||||||
FKind: TScrollBarKind;
|
FKind: TScrollBarKind;
|
||||||
FPage: TScrollBarInc;
|
FPage: TScrollBarInc;
|
||||||
FPosition: Integer;
|
|
||||||
FRange: Integer; // if AutoScroll=true this is the needed size of the child controls
|
FRange: Integer; // if AutoScroll=true this is the needed size of the child controls
|
||||||
FSmooth: Boolean;
|
FSmooth: Boolean;
|
||||||
FTracking: Boolean;
|
FTracking: Boolean;
|
||||||
@ -93,6 +92,7 @@ type
|
|||||||
FOldScrollInfoValid: Boolean;
|
FOldScrollInfoValid: Boolean;
|
||||||
protected
|
protected
|
||||||
FControl: TWinControl;
|
FControl: TWinControl;
|
||||||
|
FPosition, FPrevPosition: Integer;
|
||||||
function ControlHandle: HWnd; virtual;
|
function ControlHandle: HWnd; virtual;
|
||||||
function GetAutoScroll: boolean; virtual;
|
function GetAutoScroll: boolean; virtual;
|
||||||
function GetIncrement: TScrollBarInc; virtual;
|
function GetIncrement: TScrollBarInc; virtual;
|
||||||
@ -108,7 +108,8 @@ type
|
|||||||
procedure ScrollHandler(var Message: TLMScroll);
|
procedure ScrollHandler(var Message: TLMScroll);
|
||||||
procedure SetIncrement(const AValue: TScrollBarInc); virtual;
|
procedure SetIncrement(const AValue: TScrollBarInc); virtual;
|
||||||
procedure SetPage(const AValue: TScrollBarInc); virtual;
|
procedure SetPage(const AValue: TScrollBarInc); virtual;
|
||||||
procedure SetPosition(const Value: Integer); virtual;
|
procedure SetPosition(const Value: Integer);
|
||||||
|
procedure SetControlPosition; virtual;
|
||||||
procedure SetRange(const AValue: Integer); virtual;
|
procedure SetRange(const AValue: Integer); virtual;
|
||||||
procedure SetSmooth(const AValue: Boolean); virtual;
|
procedure SetSmooth(const AValue: Boolean); virtual;
|
||||||
procedure SetTracking(const AValue: Boolean);
|
procedure SetTracking(const AValue: Boolean);
|
||||||
|
@ -24,7 +24,7 @@ const
|
|||||||
|
|
||||||
procedure TControlScrollBar.SetPosition(const Value: Integer);
|
procedure TControlScrollBar.SetPosition(const Value: Integer);
|
||||||
var
|
var
|
||||||
OldPosition, MaxPos: Integer;
|
MaxPos: Integer;
|
||||||
ScrollInfo: TScrollInfo;
|
ScrollInfo: TScrollInfo;
|
||||||
begin
|
begin
|
||||||
if csLoading in FControl.ComponentState then
|
if csLoading in FControl.ComponentState then
|
||||||
@ -70,11 +70,11 @@ begin
|
|||||||
if Value = FPosition then
|
if Value = FPosition then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
// scroll logical client area of FControl
|
// now actually set the position
|
||||||
OldPosition := FPosition;
|
FPrevPosition := FPosition;
|
||||||
FPosition := Value;
|
FPosition := Value;
|
||||||
if FControl is TScrollingWinControl then
|
// scroll logical client area of FControl
|
||||||
TScrollingWinControl(FControl).ScrollbarHandler(Kind, OldPosition);
|
SetControlPosition;
|
||||||
|
|
||||||
// check that the new position is also set on the scrollbar
|
// check that the new position is also set on the scrollbar
|
||||||
if HandleAllocated and (GetScrollPos(ControlHandle, IntfBarKind[Kind]) <> FPosition) then
|
if HandleAllocated and (GetScrollPos(ControlHandle, IntfBarKind[Kind]) <> FPosition) then
|
||||||
@ -94,6 +94,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TControlScrollBar.SetControlPosition;
|
||||||
|
begin
|
||||||
|
if FControl is TScrollingWinControl then
|
||||||
|
TScrollingWinControl(FControl).ScrollbarHandler(Kind, FPrevPosition);
|
||||||
|
end;
|
||||||
|
|
||||||
function TControlScrollBar.GetIncrement: TScrollBarInc;
|
function TControlScrollBar.GetIncrement: TScrollBarInc;
|
||||||
begin
|
begin
|
||||||
Result := FIncrement;
|
Result := FIncrement;
|
||||||
|
@ -11,6 +11,11 @@
|
|||||||
|
|
||||||
{ TMemoScrollbar }
|
{ TMemoScrollbar }
|
||||||
|
|
||||||
|
procedure TMemoScrollbar.SetControlPosition;
|
||||||
|
begin
|
||||||
|
//TCustomMemo(FControl).ScrollBy(FPosition - FPrevPosition); No good!
|
||||||
|
end;
|
||||||
|
|
||||||
function TMemoScrollbar.GetHorzScrollBar: TControlScrollBar;
|
function TMemoScrollbar.GetHorzScrollBar: TControlScrollBar;
|
||||||
begin
|
begin
|
||||||
Result:=TCustomMemo(FControl).HorzScrollBar;
|
Result:=TCustomMemo(FControl).HorzScrollBar;
|
||||||
|
@ -804,6 +804,7 @@ type
|
|||||||
|
|
||||||
TMemoScrollbar = class(TControlScrollBar)
|
TMemoScrollbar = class(TControlScrollBar)
|
||||||
protected
|
protected
|
||||||
|
procedure SetControlPosition; override;
|
||||||
function GetHorzScrollBar: TControlScrollBar; override;
|
function GetHorzScrollBar: TControlScrollBar; override;
|
||||||
function GetVertScrollBar: TControlScrollBar; override;
|
function GetVertScrollBar: TControlScrollBar; override;
|
||||||
public
|
public
|
||||||
|
Loading…
Reference in New Issue
Block a user