diff --git a/components/lazcontrols/spinex.inc b/components/lazcontrols/spinex.inc index d6f55d0a5a..e405070786 100644 --- a/components/lazcontrols/spinex.inc +++ b/components/lazcontrols/spinex.inc @@ -323,6 +323,11 @@ begin Result := FNullValue; end; +function TSpinEditExBase.GetOrientation: TUDOrientation; +begin + Result := UpDown.Orientation; +end; + function TSpinEditExBase.GetUpDown: TUpDown; begin Result := TUpDown(Buddy); @@ -335,6 +340,20 @@ begin UpdateControl; end; +procedure TSpinEditExBase.SetOrientation(AValue: TUDOrientation); +var + w: Integer; +begin + if GetOrientation = AValue then + exit; + w := UpDown.Width; + UpDown.Orientation := AValue; + case GetOrientation of + udVertical: UpDown.Width := w div 2; + udHorizontal: UpDown.Width := w * 2; + end; +end; + constructor TSpinEditExBase.Create(TheOwner: TComponent); begin inherited Create(TheOwner); diff --git a/components/lazcontrols/spinex.pp b/components/lazcontrols/spinex.pp index 4b3e8c47d8..9b2c6814de 100644 --- a/components/lazcontrols/spinex.pp +++ b/components/lazcontrols/spinex.pp @@ -112,6 +112,7 @@ type FMustSetModifiedToTrueInOnChange: Boolean; FNullValue: T; FNullValueBehaviour: TNullValueBehaviour; + FOrientation: TUDOrientation; FValue: T; FUpdatePending: Boolean; FSettingValue: Boolean; @@ -119,6 +120,7 @@ type procedure SetMinRepeatValue(AValue: Byte); procedure SpinUpDown(Up: Boolean); function GetNullValue: T; + function GetOrientation: TUDOrientation; function GetUpDown: TUpDown; function GetValue: T; function IncrementStored: Boolean; @@ -126,6 +128,7 @@ type function IsOutOfLimits(AValue: T): Boolean; function MaxValueStored: Boolean; function MinValueStored: Boolean; + procedure SetOrientation(AValue: TUDOrientation); procedure UpdateControl; procedure UpDownChangingEx(Sender: TObject; var {%H-}AllowChange: Boolean; {%H-}NewValue: SmallInt; Direction: TUpDownDirection); @@ -161,6 +164,7 @@ type property UpDown: TUpDown read GetUpDown; property UpDownVisible: Boolean read GetBuddyVisible write SetBuddyVisible default True; property MinRepeatValue: Byte read FMinRepeatValue write SetMinRepeatValue default DefMinRepeatValue; + property Orientation: TUDOrientation read GetOrientation write SetOrientation default udVertical; public constructor Create(TheOwner: TComponent); override; function GetLimitedValue(const AValue: T): T; virtual; @@ -301,6 +305,7 @@ type property MinRepeatValue; property NullValue; property NullValueBehaviour; + property Orientation; property Spacing; property UpDownVisible; property Value; @@ -406,6 +411,7 @@ type property MinRepeatValue; property NullValue; property NullValueBehaviour; + property Orientation; property Spacing; property ThousandSeparator; property UpDownVisible;