From 24756e40d15220665490bce0dc27fc484f92ba86 Mon Sep 17 00:00:00 2001 From: juha Date: Tue, 19 Jun 2018 08:04:04 +0000 Subject: [PATCH] LazControls: Add property UpDownVisible to SpinEditEx controls. git-svn-id: trunk@58322 - --- components/lazcontrols/spinex.inc | 14 ++++++++------ components/lazcontrols/spinex.pp | 7 ++++++- lcl/groupededit.pp | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/components/lazcontrols/spinex.inc b/components/lazcontrols/spinex.inc index 81d4edf37c..7fcbe7f0e0 100644 --- a/components/lazcontrols/spinex.inc +++ b/components/lazcontrols/spinex.inc @@ -66,8 +66,6 @@ begin end; end; - - procedure TSpinEditExBase.UpDownChangingEx(Sender: TObject; var AllowChange: Boolean; NewValue: SmallInt; Direction: TUpDownDirection); begin @@ -83,14 +81,11 @@ begin BuddyClick; end; - function TSpinEditExBase.GetBuddyClassType: TControlClass; begin Result := TUpDown; end; - - procedure TSpinEditExBase.DoEnter; begin inherited DoEnter; @@ -259,7 +254,6 @@ begin Result := IsLimited and ((AValue < MinValue) or (AValue > MaxValue)); end; - function TSpinEditExBase.GetEdit: TGEEdit; begin Result := BaseEditor; @@ -273,6 +267,13 @@ begin UpDown.MinRepeatInterval := FMinRepeatValue; end; +procedure TSpinEditExBase.SetUpDownVisible(AValue: Boolean); +begin + if FUpDownVisible=AValue then Exit; + FUpDownVisible:=AValue; + UpDown.Visible:=AValue; + UpdateSpacing; +end; procedure TSpinEditExBase.SpinUpDown(Up: Boolean); var @@ -317,6 +318,7 @@ begin inherited Create(TheOwner); FArrowKeys := True; + FUpDownVisible := True; FIncrement := DefIncrement; FMaxValue := DefMaxValue; FUpdatePending := True; diff --git a/components/lazcontrols/spinex.pp b/components/lazcontrols/spinex.pp index 6091cbb69d..a0b7962400 100644 --- a/components/lazcontrols/spinex.pp +++ b/components/lazcontrols/spinex.pp @@ -65,7 +65,7 @@ ---------------------------------------------------------------------------- } -unit spinex; +unit SpinEx; {$mode objfpc}{$H+} @@ -112,9 +112,11 @@ type FNullValueBehaviour: TNullValueBehaviour; FValue: T; FUpdatePending: Boolean; + FUpDownVisible: Boolean; FSettingValue: Boolean; function GetEdit: TGEEdit; procedure SetMinRepeatValue(AValue: Byte); + procedure SetUpDownVisible(AValue: Boolean); procedure SpinUpDown(Up: Boolean); function GetNullValue: T; function GetUpDown: TUpDown; @@ -151,6 +153,7 @@ type property ArrowKeys: Boolean read FArrowKeys write FArrowKeys default True; property Edit: TGEEdit read GetEdit; property UpDown: TUpDown read GetUpDown; + property UpDownVisible: Boolean read FUpDownVisible write SetUpDownVisible; property MinRepeatValue: Byte read FMinRepeatValue write SetMinRepeatValue default DefMinRepeatValue; public constructor Create(TheOwner: TComponent); override; @@ -270,6 +273,7 @@ type property NullValue; property NullValueBehaviour; property Spacing; + property UpDownVisible; property Value; end; @@ -366,6 +370,7 @@ type property NullValue; property NullValueBehaviour; property Spacing; + property UpDownVisible; property Value; end; diff --git a/lcl/groupededit.pp b/lcl/groupededit.pp index ba606fb131..c908cadd7f 100644 --- a/lcl/groupededit.pp +++ b/lcl/groupededit.pp @@ -70,7 +70,7 @@ type FIsReadOnly: Boolean; FLayout: TLeftRight; FSpacing: Integer; - //Forwarded events from FButton + //Forwarded events from FBuddy FOnBuddyClick: TNotifyEvent; //Forwarded events from FEdit FOnEditClick: TNotifyEvent;