summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-10-20 14:40:18 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-10-20 14:40:18 +0000
commitfb7c292dff1c61c7b4b598687de59531febc629f (patch)
treeab3dc5ab721d32c479c3d0ec98a8c62aa77597c4 /src
parent8c8b39dd6b0b99d864ebfe8cf1106a5c3d6261ce (diff)
downloadfpGUI-fb7c292dff1c61c7b4b598687de59531febc629f.tar.xz
* SpinEdit controls needed some published events.
* Spinedit controls got OnChange event. * tiOPF: Updated the SpinEdit and CheckBox mediators to hook into the OnChange events.
Diffstat (limited to 'src')
-rw-r--r--src/gui/fpg_checkbox.pas2
-rw-r--r--src/gui/fpg_spinedit.pas35
2 files changed, 37 insertions, 0 deletions
diff --git a/src/gui/fpg_checkbox.pas b/src/gui/fpg_checkbox.pas
index c185272c..9e7c887e 100644
--- a/src/gui/fpg_checkbox.pas
+++ b/src/gui/fpg_checkbox.pas
@@ -61,6 +61,8 @@ type
property Text: string read FText write SetText;
property TextColor;
property OnChange: TNotifyEvent read FOnChange write FOnChange;
+ property OnEnter;
+ property OnExit;
end;
diff --git a/src/gui/fpg_spinedit.pas b/src/gui/fpg_spinedit.pas
index c92aa7ef..b7a85dbb 100644
--- a/src/gui/fpg_spinedit.pas
+++ b/src/gui/fpg_spinedit.pas
@@ -55,6 +55,7 @@ type
FButtonDown: TfpgButton;
FArrowUpColor: Tfpgcolor;
FArrowDownColor: Tfpgcolor;
+ FOnChange: TNotifyEvent;
FTimer: TfpgTimer;
FUp: Boolean;
FDown: Boolean;
@@ -63,6 +64,7 @@ type
procedure SetButtonWidth(const AValue: integer);
protected
FButtonWidth: integer;
+ procedure DoOnChange; virtual;
procedure ResizeChildren; virtual;
procedure HandlePaint; override;
procedure HandleResize(AWidth, AHeight: TfpgCoord); override;
@@ -80,6 +82,7 @@ type
property ArrowDownColor: TfpgColor read FArrowDownColor write SetArrowDownColor;
property ButtonWidth: integer read FButtonWidth write SetButtonWidth default 13;
property StepsSpeedUp: integer read FSpeedUpSteps write SetSpeedUp;
+ property OnChange: TNotifyEvent read FOnChange write FOnChange;
public
constructor Create(AOwner: TComponent); override;
end;
@@ -147,6 +150,13 @@ type
property Decimals: integer read GetDecimals write SetDecimals;
property FixedDecimals: Boolean read GetFixedDecimals write SetFixedDecimals;
property Hint: string read FHint write SetHint;
+ property OnChange;
+ property OnEnter;
+ property OnExit;
+ property OnKeyPress;
+ property OnMouseEnter;
+ property OnMouseExit;
+ property OnPaint;
end;
@@ -207,6 +217,13 @@ type
property LargeIncrement: integer read FLargeIncrement write SetLargeIncrement default 10;
property Value: integer read FValue write SetValue default 0;
property Hint: string read FHint write SetHint;
+ property OnChange;
+ property OnEnter;
+ property OnExit;
+ property OnKeyPress;
+ property OnMouseEnter;
+ property OnMouseExit;
+ property OnPaint;
end;
@@ -290,6 +307,12 @@ begin
RePaint;
end;
+procedure TfpgAbstractSpinEdit.DoOnChange;
+begin
+ if Assigned(FOnChange) then
+ FOnChange(self);
+end;
+
procedure TfpgAbstractSpinEdit.ResizeChildren;
begin
FButtonUp.SetPosition(Width - FButtonWidth, 0, FButtonWidth, Height div 2);
@@ -609,13 +632,19 @@ end;
procedure TfpgSpinEditFloat.ButtonUpClick(Sender: TObject);
begin
if FValue + FIncrement <= FMaxValue then
+ begin
Value := FValue + FIncrement;
+ DoOnChange;
+ end;
end;
procedure TfpgSpinEditFloat.ButtonDownClick(Sender: TObject);
begin
if FValue - FIncrement >= FMinValue then
+ begin
Value := FValue - FIncrement;
+ DoOnChange;
+ end;
end;
procedure TfpgSpinEditFloat.ButtonUpMouseDown(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint);
@@ -783,6 +812,7 @@ begin
Inc(FSteps);
if FSteps > FSpeedUpSteps then
FTempIncrement := LargeIncrement;
+ DoOnChange;
end;
end
else if FDown then
@@ -795,6 +825,7 @@ begin
Inc(FSteps);
if FSteps > FSpeedUpSteps then
FTempIncrement := LargeIncrement;
+ DoOnChange;
end;
end;
EnableButtons;
@@ -1003,12 +1034,14 @@ procedure TfpgSpinEdit.ButtonUpClick(Sender: TObject);
begin
if FValue + FIncrement <= FMaxValue then
Value := FValue + FIncrement;
+ DoOnChange;
end;
procedure TfpgSpinEdit.ButtonDownClick(Sender: TObject);
begin
if FValue - FIncrement >= FMinValue then
Value := FValue - FIncrement;
+ DoOnChange;
end;
procedure TfpgSpinEdit.ButtonUpMouseDown(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint);
@@ -1178,6 +1211,7 @@ begin
Inc(FSteps);
if FSteps > FSpeedUpSteps then
FTempIncrement := LargeIncrement;
+ DoOnchange;
end;
end
else if FDown then
@@ -1190,6 +1224,7 @@ begin
Inc(FSteps);
if FSteps > FSpeedUpSteps then
FTempIncrement := LargeIncrement;
+ DoOnChange;
end;
end;
EnableButtons;