mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 19:16:16 +02:00
TUpDown: implement property MinRepeatInterval.
git-svn-id: trunk@51300 -
This commit is contained in:
parent
8faa0fe7f0
commit
a6eb71dd7f
@ -1825,6 +1825,7 @@ type
|
||||
|
||||
{ TCustomUpDown }
|
||||
|
||||
|
||||
TCustomUpDown = class(TCustomControl)
|
||||
private
|
||||
FAlignButton: TUDAlignButton;
|
||||
@ -1837,6 +1838,7 @@ type
|
||||
FMaxBtn: TControl; // TSpeedButton (TUpDownButton)
|
||||
FMin: SmallInt;
|
||||
FMinBtn: TControl; // TSpeedButton (TUpDownButton)
|
||||
FMinRepeatInterval: Byte; //Interval starts at 300 and this must be smaller always
|
||||
FMouseDownBounds : TRect;
|
||||
FMouseTimerEvent: TProcedureOfObject; // the Min/MaxBtn's Click method
|
||||
FOnChanging: TUDChangingEvent;
|
||||
@ -1854,6 +1856,7 @@ type
|
||||
procedure SetIncrement(Value: Integer);
|
||||
procedure SetMax(Value: SmallInt);
|
||||
procedure SetMin(Value: SmallInt);
|
||||
procedure SetMinRepeatInterval(AValue: Byte);
|
||||
procedure SetOrientation(Value: TUDOrientation);
|
||||
procedure SetPosition(Value: SmallInt);
|
||||
procedure SetThousands(Value: Boolean);
|
||||
@ -1882,6 +1885,7 @@ type
|
||||
property Increment: Integer read FIncrement write SetIncrement default 1;
|
||||
property Max: SmallInt read FMax write SetMax default 100;
|
||||
property Min: SmallInt read FMin write SetMin;
|
||||
property MinRepeatInterval: Byte read FMinRepeatInterval write SetMinRepeatInterval default 100;
|
||||
property OnChanging: TUDChangingEvent read FOnChanging write FOnChanging;
|
||||
property OnChangingEx: TUDChangingEventEx read FOnChangingEx write FOnChangingEx;
|
||||
property OnClick: TUDClickEvent read FOnClick write FOnClick;
|
||||
@ -1910,6 +1914,7 @@ type
|
||||
property Increment;
|
||||
property Max;
|
||||
property Min;
|
||||
property MinRepeatInterval;
|
||||
property OnChanging;
|
||||
property OnChangingEx;
|
||||
property OnClick;
|
||||
|
@ -215,6 +215,7 @@ begin
|
||||
SetInitialBounds(0, 0, CX, CY);
|
||||
FArrowKeys := True;
|
||||
FMax := 100;
|
||||
FMinRepeatInterval := 100;
|
||||
FIncrement := 1;
|
||||
FAlignButton := udRight;
|
||||
FThousands := True;
|
||||
@ -227,11 +228,17 @@ begin
|
||||
end;
|
||||
|
||||
procedure TCustomUpDown.BTimerExec(Sender : TObject);
|
||||
var
|
||||
AInterval:Integer;
|
||||
begin
|
||||
If Assigned(FMouseTimerEvent)
|
||||
and PtInRect(FMouseDownBounds,Mouse.CursorPos) then begin
|
||||
if TTimer(Sender).Interval > 100
|
||||
then TTimer(Sender).Interval := TTimer(Sender).Interval - 25;
|
||||
AInterval := TTimer(Sender).Interval;
|
||||
if AInterval > FMinRepeatInterval then begin
|
||||
AInterval := AInterval - 25;
|
||||
if AInterval < FMinRepeatInterval then AInterval := FMinRepeatInterval;
|
||||
TTimer(Sender).Interval := AInterval;
|
||||
end;
|
||||
FMouseTimerEvent;
|
||||
end;
|
||||
end;
|
||||
@ -485,6 +492,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomUpDown.SetMinRepeatInterval(AValue: Byte);
|
||||
begin
|
||||
if FMinRepeatInterval = AValue then Exit;
|
||||
FMinRepeatInterval := AValue;
|
||||
if FMinRepeatInterval < 25 then FMinRepeatInterval := 25;
|
||||
end;
|
||||
|
||||
procedure TCustomUpDown.SetMax(Value: SmallInt);
|
||||
begin
|
||||
if Value <> FMax then
|
||||
|
Loading…
Reference in New Issue
Block a user