mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 11:39:09 +02:00
Some improvements to the new TCDTrackBar.OnChangeByUser event
git-svn-id: trunk@35114 -
This commit is contained in:
parent
88f38a5ae9
commit
e10dc0f7ea
@ -1778,11 +1778,18 @@ end;
|
|||||||
procedure TCDPositionedControl.DoClickButton(AButton: TCDControlState; ALargeChange: Boolean);
|
procedure TCDPositionedControl.DoClickButton(AButton: TCDControlState; ALargeChange: Boolean);
|
||||||
var
|
var
|
||||||
lChange: Integer;
|
lChange: Integer;
|
||||||
|
NewPosition: Integer = -1;
|
||||||
begin
|
begin
|
||||||
if ALargeChange then lChange := FLargeChange
|
if ALargeChange then lChange := FLargeChange
|
||||||
else lChange := FSmallChange;
|
else lChange := FSmallChange;
|
||||||
if csfLeftArrow in AButton then Position := Position - lChange
|
if csfLeftArrow in AButton then NewPosition := Position - lChange
|
||||||
else if csfRightArrow in AButton then Position := Position + lChange;
|
else if csfRightArrow in AButton then NewPosition := Position + lChange;
|
||||||
|
|
||||||
|
if (NewPosition >= 0) and (NewPosition <> Position) then
|
||||||
|
begin
|
||||||
|
Position := NewPosition;
|
||||||
|
if Assigned(FOnChangeByUser) then FOnChangeByUser(Self);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCDPositionedControl.HandleBtnClickTimer(ASender: TObject);
|
procedure TCDPositionedControl.HandleBtnClickTimer(ASender: TObject);
|
||||||
@ -1900,7 +1907,11 @@ begin
|
|||||||
if NewPosition > FMax then NewPosition := FMax;
|
if NewPosition > FMax then NewPosition := FMax;
|
||||||
if NewPosition < FMin then NewPosition := FMin;
|
if NewPosition < FMin then NewPosition := FMin;
|
||||||
|
|
||||||
Position := NewPosition;
|
if (NewPosition <> Position) then
|
||||||
|
begin
|
||||||
|
Position := NewPosition;
|
||||||
|
if Assigned(FOnChangeByUser) then FOnChangeByUser(Self);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1920,7 +1931,11 @@ begin
|
|||||||
begin
|
begin
|
||||||
NewPosition := GetPositionFromMousePos(X, Y);
|
NewPosition := GetPositionFromMousePos(X, Y);
|
||||||
DragDropStarted := True;
|
DragDropStarted := True;
|
||||||
if NewPosition >= 0 then Position := NewPosition;
|
if (NewPosition >= 0) and (NewPosition <> Position) then
|
||||||
|
begin
|
||||||
|
Position := NewPosition;
|
||||||
|
if Assigned(FOnChangeByUser) then FOnChangeByUser(Self);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Check if any buttons were clicked
|
// Check if any buttons were clicked
|
||||||
|
Loading…
Reference in New Issue
Block a user