From dbd547b619aaad509bbac6928b8e7d689b2ec795 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Tue, 18 Aug 2015 15:42:02 +0100 Subject: fpg_spinedit: Introduced a new overloaded CreateSpinEdit() function. It is a bit more simplified, and only sets essential properties, leaving the rest as widget defaults. --- src/gui/fpg_spinedit.pas | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gui/fpg_spinedit.pas b/src/gui/fpg_spinedit.pas index 280529d4..b344b6c5 100644 --- a/src/gui/fpg_spinedit.pas +++ b/src/gui/fpg_spinedit.pas @@ -238,7 +238,8 @@ function CreateSpinEditFloat(AOwner: TComponent; x, y, w, h: TfpgCoord; AFixedDecimals: integer = 1; AValue: extended = 0; ADecimals: integer = -1): TfpgSpinEditFloat; function CreateSpinEdit(AOwner: TComponent; x, y, w, h: TfpgCoord; AMinValue: integer = 0; AMaxValue: integer = 100; AIncrement: integer = 1; ALargeIncrement: integer = 10; - AValue: integer = 0): TfpgSpinEdit; + AValue: integer = 0): TfpgSpinEdit; overload; +function CreateSpinEdit(AOwner: TComponent; x, y, w: TfpgCoord; AOnChangeEvent: TNotifyEvent = nil): TfpgSpinEdit; overload; implementation @@ -299,6 +300,15 @@ begin Result.Value := AValue; end; +function CreateSpinEdit(AOwner: TComponent; x, y, w: TfpgCoord; AOnChangeEvent: TNotifyEvent): TfpgSpinEdit; +begin + Result := TfpgSpinEdit.Create(AOwner); + Result.SetPosition(x, y, w, Result.Height); + if Assigned(AOnChangeEvent) then + Result.OnChange := AOnChangeEvent; + Result.UpdatePosition; +end; + { TfpgAbstractSpinEdit } -- cgit v1.2.3-70-g09d2