mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 12:20:38 +02:00
MG: reduced messages of TScrollingWinControl
git-svn-id: trunk@3576 -
This commit is contained in:
parent
61e5bd0b14
commit
1df9cbaea5
@ -88,13 +88,9 @@ type
|
|||||||
procedure ScrollHandler(var Message: TLMScroll);
|
procedure ScrollHandler(var Message: TLMScroll);
|
||||||
public
|
public
|
||||||
constructor Create(AControl: TScrollingWinControl; AKind: TScrollBarKind);
|
constructor Create(AControl: TScrollingWinControl; AKind: TScrollBarKind);
|
||||||
|
|
||||||
procedure Assign(Source: TPersistent); override;
|
procedure Assign(Source: TPersistent); override;
|
||||||
|
|
||||||
function IsScrollBarVisible: Boolean;
|
function IsScrollBarVisible: Boolean;
|
||||||
|
|
||||||
function ScrollPos: Integer;
|
function ScrollPos: Integer;
|
||||||
|
|
||||||
property Kind: TScrollBarKind read FKind;
|
property Kind: TScrollBarKind read FKind;
|
||||||
published
|
published
|
||||||
property Increment: TScrollBarInc read FIncrement write FIncrement default 8;
|
property Increment: TScrollBarInc read FIncrement write FIncrement default 8;
|
||||||
|
@ -22,7 +22,8 @@ procedure TControlScrollBar.SetPosition(Value: Integer);
|
|||||||
Tmp := FPosition;
|
Tmp := FPosition;
|
||||||
FPosition := Value;
|
FPosition := Value;
|
||||||
FControl.ScrollBy(0, Tmp - FPosition);
|
FControl.ScrollBy(0, Tmp - FPosition);
|
||||||
if GetScrollPos(FControl.Handle, SB_VERT) <> FPosition then
|
if FControl.HandleAllocated
|
||||||
|
and (GetScrollPos(FControl.Handle, SB_VERT) <> FPosition) then
|
||||||
SetScrollPos(FControl.Handle, SB_VERT, FPosition, Visible);
|
SetScrollPos(FControl.Handle, SB_VERT, FPosition, Visible);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -33,7 +34,8 @@ procedure TControlScrollBar.SetPosition(Value: Integer);
|
|||||||
Tmp := FPosition;
|
Tmp := FPosition;
|
||||||
FPosition := Value;
|
FPosition := Value;
|
||||||
FControl.ScrollBy(Tmp - FPosition, 0);
|
FControl.ScrollBy(Tmp - FPosition, 0);
|
||||||
if GetScrollPos(FControl.Handle, SB_HORZ) <> FPosition then
|
if FControl.HandleAllocated
|
||||||
|
and (GetScrollPos(FControl.Handle, SB_HORZ) <> FPosition) then
|
||||||
SetScrollPos(FControl.Handle, SB_HORZ, FPosition, Visible);
|
SetScrollPos(FControl.Handle, SB_HORZ, FPosition, Visible);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -52,6 +54,13 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if Value>Range then begin
|
||||||
|
SetPosition(Range);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if Value=FPosition then exit;
|
||||||
|
|
||||||
if Kind = sbVertical then
|
if Kind = sbVertical then
|
||||||
SetVPosition
|
SetVPosition
|
||||||
@ -66,18 +75,21 @@ begin
|
|||||||
Range := 0;
|
Range := 0;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
if FRange=Value then exit;
|
||||||
FRange := Value;
|
FRange := Value;
|
||||||
FControl.UpdateScrollBars;
|
FControl.UpdateScrollBars;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TControlScrollBar.SetVisible(Value: Boolean);
|
procedure TControlScrollBar.SetVisible(Value: Boolean);
|
||||||
begin
|
begin
|
||||||
|
if FVisible = Value then exit;
|
||||||
FVisible := Value;
|
FVisible := Value;
|
||||||
FControl.UpdateScrollBars;
|
FControl.UpdateScrollBars;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TControlScrollBar.SetSmooth(Value: Boolean);
|
procedure TControlScrollBar.SetSmooth(Value: Boolean);
|
||||||
begin
|
begin
|
||||||
|
if FSmooth = Value then exit;
|
||||||
FSmooth := Value;
|
FSmooth := Value;
|
||||||
FControl.UpdateScrollBars;
|
FControl.UpdateScrollBars;
|
||||||
end;
|
end;
|
||||||
@ -136,7 +148,7 @@ var
|
|||||||
procedure UpdateVScroll;
|
procedure UpdateVScroll;
|
||||||
begin
|
begin
|
||||||
With FControl do begin
|
With FControl do begin
|
||||||
Page := ClientHeight + 1;
|
Page := Min(ClientHeight + 1,High(Page));
|
||||||
ScrollInfo.nPage := Page;
|
ScrollInfo.nPage := Page;
|
||||||
|
|
||||||
if Visible then begin
|
if Visible then begin
|
||||||
@ -146,20 +158,21 @@ var
|
|||||||
else
|
else
|
||||||
ScrollInfo.nMax := 0;
|
ScrollInfo.nMax := 0;
|
||||||
|
|
||||||
If (Self.Visible and not FAutoScroll) or (FAutoScroll and (ScrollInfo.nMax > 0) and
|
If (Self.Visible and not FAutoScroll)
|
||||||
(ScrollInfo.nMax > Height))
|
or (FAutoScroll and (ScrollInfo.nMax > 0) and (ScrollInfo.nMax > Height))
|
||||||
then
|
then
|
||||||
Self.FVisible := True
|
Self.FVisible := True
|
||||||
else
|
else
|
||||||
Self.FVisible := False;
|
Self.FVisible := False;
|
||||||
SetScrollInfo(Handle, SB_VERT, ScrollInfo, Self.Visible);
|
if HandleAllocated then
|
||||||
|
SetScrollInfo(Handle, SB_VERT, ScrollInfo, Self.Visible);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure UpdateHScroll;
|
procedure UpdateHScroll;
|
||||||
begin
|
begin
|
||||||
With FControl do begin
|
With FControl do begin
|
||||||
Page := ClientWidth + 1;
|
Page := Min(ClientWidth + 1,High(Page));
|
||||||
ScrollInfo.nPage := Page;
|
ScrollInfo.nPage := Page;
|
||||||
|
|
||||||
if Visible then begin
|
if Visible then begin
|
||||||
@ -169,13 +182,14 @@ var
|
|||||||
else
|
else
|
||||||
ScrollInfo.nMax := 0;
|
ScrollInfo.nMax := 0;
|
||||||
|
|
||||||
If (Self.Visible and not FAutoScroll) or (FAutoScroll and (ScrollInfo.nMax > 0) and
|
If (Self.Visible and not FAutoScroll)
|
||||||
(ScrollInfo.nMax > Width))
|
or (FAutoScroll and (ScrollInfo.nMax > 0) and (ScrollInfo.nMax > Width))
|
||||||
then
|
then
|
||||||
Self.FVisible := True
|
Self.FVisible := True
|
||||||
else
|
else
|
||||||
Self.FVisible := False;
|
Self.FVisible := False;
|
||||||
SetScrollInfo(Handle, SB_HORZ, ScrollInfo, Self.Visible);
|
if HandleAllocated then
|
||||||
|
SetScrollInfo(Handle, SB_HORZ, ScrollInfo, Self.Visible);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -269,7 +283,10 @@ end;
|
|||||||
|
|
||||||
function TControlScrollBar.ScrollPos: Integer;
|
function TControlScrollBar.ScrollPos: Integer;
|
||||||
begin
|
begin
|
||||||
Result := Position*ShortInt(Visible);
|
if Visible then
|
||||||
|
Result:=Position
|
||||||
|
else
|
||||||
|
Result:=0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TScrollingWinControl.SetAutoScroll(Value: Boolean);
|
procedure TScrollingWinControl.SetAutoScroll(Value: Boolean);
|
||||||
|
Loading…
Reference in New Issue
Block a user