From 6a1f2b06c5c11288afd376a6310ff088484768e9 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Tue, 18 Aug 2015 15:40:36 +0100 Subject: SpinEdit & SpinEditFloat now has a default Height - same as TfpgEdit. --- src/gui/fpg_spinedit.pas | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gui/fpg_spinedit.pas') diff --git a/src/gui/fpg_spinedit.pas b/src/gui/fpg_spinedit.pas index 6061eb3b..280529d4 100644 --- a/src/gui/fpg_spinedit.pas +++ b/src/gui/fpg_spinedit.pas @@ -427,6 +427,7 @@ end; constructor TfpgAbstractSpinEdit.Create(AOwner: TComponent); begin inherited Create(AOwner); + FHeight := 24; FButtonWidth := 13; // width of spin buttons Shape := bsSpacer; -- cgit v1.2.3-70-g09d2 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(-) (limited to 'src/gui/fpg_spinedit.pas') 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 From e652861b57ed4ad2cb85d896b29de53f7d936583 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Mon, 17 Aug 2015 10:22:11 +0100 Subject: spinedit: minor code formatting --- src/gui/fpg_spinedit.pas | 90 ++++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 45 deletions(-) (limited to 'src/gui/fpg_spinedit.pas') diff --git a/src/gui/fpg_spinedit.pas b/src/gui/fpg_spinedit.pas index b344b6c5..254dd917 100644 --- a/src/gui/fpg_spinedit.pas +++ b/src/gui/fpg_spinedit.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -175,53 +175,53 @@ type FValue: integer; procedure EnableButtons; protected - function IsMinLimitReached: Boolean; override; - function IsMaxLimitReached: Boolean; override; - function GetEditBackgroundColor: TfpgColor; - function GetTextColor: TfpgColor; - function GetNegativeColor: TfpgColor; - function GetFontDesc: string; - procedure ResizeChildren; override; - procedure SetEditBackgroundColor(const AValue: Tfpgcolor); - procedure SetTextColor(const AValue: Tfpgcolor); override; - procedure SetNegativeColor(const AValue: Tfpgcolor); - procedure SetFontDesc(const AValue: string); - procedure SetMaxValue(const AValue: integer); - procedure SetMinValue(const AValue: integer); - procedure SetIncrement(const AValue: integer); - procedure SetLargeIncrement(const AValue: integer); - procedure SetValue(const AValue: integer); - procedure SetHint(const AValue: TfpgString); override; - procedure ButtonUpClick(Sender: TObject); - procedure ButtonDownClick(Sender: TObject); - procedure ButtonUpMouseDown(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); - procedure ButtonUpMouseUp(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); - procedure ButtonDownMouseDown(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); - procedure ButtonDownMouseUp(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); - procedure EditKeyPress(Sender: TObject; var keycode: word; var shiftstate: TShiftState; var consumed: Boolean); - procedure EditExit(Sender: TObject); - procedure MouseEnter(Sender: TObject); - procedure MouseMove(Sender: TObject; AShift: TShiftState; const AMousePos: TPoint); - procedure MouseExit(Sender: TObject); - procedure TimerStep(Sender: TObject); + function IsMinLimitReached: Boolean; override; + function IsMaxLimitReached: Boolean; override; + function GetEditBackgroundColor: TfpgColor; + function GetTextColor: TfpgColor; + function GetNegativeColor: TfpgColor; + function GetFontDesc: string; + procedure ResizeChildren; override; + procedure SetEditBackgroundColor(const AValue: Tfpgcolor); + procedure SetTextColor(const AValue: Tfpgcolor); override; + procedure SetNegativeColor(const AValue: Tfpgcolor); + procedure SetFontDesc(const AValue: string); + procedure SetMaxValue(const AValue: integer); + procedure SetMinValue(const AValue: integer); + procedure SetIncrement(const AValue: integer); + procedure SetLargeIncrement(const AValue: integer); + procedure SetValue(const AValue: integer); + procedure SetHint(const AValue: TfpgString); override; + procedure ButtonUpClick(Sender: TObject); + procedure ButtonDownClick(Sender: TObject); + procedure ButtonUpMouseDown(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); + procedure ButtonUpMouseUp(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); + procedure ButtonDownMouseDown(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); + procedure ButtonDownMouseUp(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); + procedure EditKeyPress(Sender: TObject; var keycode: word; var shiftstate: TShiftState; var consumed: Boolean); + procedure EditExit(Sender: TObject); + procedure MouseEnter(Sender: TObject); + procedure MouseMove(Sender: TObject; AShift: TShiftState; const AMousePos: TPoint); + procedure MouseExit(Sender: TObject); + procedure TimerStep(Sender: TObject); public constructor Create(AOwner: TComponent); override; published - property EditBackgroundColor: Tfpgcolor read GetEditBackgroundColor write SetEditBackgroundColor default clBoxColor; - property ButtonsBackgroundColor; - property ButtonWidth; - property TextColor: Tfpgcolor read GetTextColor write SetTextColor; - property NegativeColor: TfpgColor read GetNegativeColor write SetNegativeColor; - property ArrowUpColor; - property ArrowDownColor; - property FontDesc: string read GetFontDesc write SetFontDesc; - property MaxValue: integer read FMaxValue write SetMaxValue default 100; - property MinValue: integer read FMinValue write SetMinValue default 0; - property Increment: integer read FIncrement write SetIncrement default 1; - property LargeIncrement: integer read FLargeIncrement write SetLargeIncrement default 10; - property Value: integer read FValue write SetValue default 0; - property Hint; - property TabOrder; + property EditBackgroundColor: Tfpgcolor read GetEditBackgroundColor write SetEditBackgroundColor default clBoxColor; + property ButtonsBackgroundColor; + property ButtonWidth; + property TextColor: Tfpgcolor read GetTextColor write SetTextColor; + property NegativeColor: TfpgColor read GetNegativeColor write SetNegativeColor; + property ArrowUpColor; + property ArrowDownColor; + property FontDesc: string read GetFontDesc write SetFontDesc; + property MaxValue: integer read FMaxValue write SetMaxValue default 100; + property MinValue: integer read FMinValue write SetMinValue default 0; + property Increment: integer read FIncrement write SetIncrement default 1; + property LargeIncrement: integer read FLargeIncrement write SetLargeIncrement default 10; + property Value: integer read FValue write SetValue default 0; + property Hint; + property TabOrder; property OnChange; property OnEnter; property OnExit; -- cgit v1.2.3-70-g09d2 From 184831a8019f72c50da37fbf30f6a6eab541bae2 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sat, 22 Aug 2015 12:25:37 +0100 Subject: Minor compilation fix - differences between stable vs develop branch --- src/gui/fpg_spinedit.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui/fpg_spinedit.pas') diff --git a/src/gui/fpg_spinedit.pas b/src/gui/fpg_spinedit.pas index 254dd917..97de1027 100644 --- a/src/gui/fpg_spinedit.pas +++ b/src/gui/fpg_spinedit.pas @@ -306,7 +306,7 @@ begin Result.SetPosition(x, y, w, Result.Height); if Assigned(AOnChangeEvent) then Result.OnChange := AOnChangeEvent; - Result.UpdatePosition; + Result.UpdateWindowPosition; end; -- cgit v1.2.3-70-g09d2