summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/gui/splashscreen/frm_splashscreen.pas3
-rw-r--r--src/corelib/gfx_widget.pas7
-rw-r--r--src/gui/gui_bevel.pas2
-rw-r--r--src/gui/gui_button.pas2
-rw-r--r--src/gui/gui_label.pas2
5 files changed, 14 insertions, 2 deletions
diff --git a/examples/gui/splashscreen/frm_splashscreen.pas b/examples/gui/splashscreen/frm_splashscreen.pas
index 14030f2d..c8dcb468 100644
--- a/examples/gui/splashscreen/frm_splashscreen.pas
+++ b/examples/gui/splashscreen/frm_splashscreen.pas
@@ -84,6 +84,7 @@ begin
begin
Name := 'pnlName1';
SetPosition(0, 0, 300, 64);
+ OnClick := @TimerFired;
end;
lblName2 := TfpgLabel.Create(pnlName1);
@@ -93,6 +94,7 @@ begin
SetPosition(24, 8, 272, 31);
Text := 'Splash screen goes here!';
FontDesc := 'Arial-18';
+ OnClick := @TimerFired;
end;
lblName1 := TfpgLabel.Create(pnlName1);
@@ -102,6 +104,7 @@ begin
SetPosition(52, 42, 188, 15);
Text := 'Click me to make me disappear.';
FontDesc := '#Label1';
+ OnClick := @TimerFired;
end;
{@VFD_BODY_END: SplashForm}
diff --git a/src/corelib/gfx_widget.pas b/src/corelib/gfx_widget.pas
index d881bd1a..49ece1f8 100644
--- a/src/corelib/gfx_widget.pas
+++ b/src/corelib/gfx_widget.pas
@@ -17,6 +17,7 @@ type
TfpgWidget = class(TfpgWindow)
private
FAlignRect: TfpgRect;
+ FOnClick: TNotifyEvent;
FOnDoubleClick: TMouseButtonEvent;
FOnMouseDown: TMouseButtonEvent;
FOnMouseEnter: TNotifyEvent;
@@ -87,6 +88,7 @@ type
property OnMouseMove: TMouseMoveEvent read FOnMouseMove write FOnMouseMove;
property OnMouseDown: TMouseButtonEvent read FOnMouseDown write FOnMouseDown;
property OnMouseUp: TMouseButtonEvent read FOnMouseUp write FOnMouseUp;
+ property OnClick: TNotifyEvent read FOnClick write FOnClick;
property OnDoubleClick: TMouseButtonEvent read FOnDoubleClick write FOnDoubleClick;
property OnKeyPress: TKeyPressEvent read FOnKeyPress write FOnKeyPress;
public
@@ -384,7 +386,10 @@ begin
if Assigned(FOnDoubleClick) then
FOnDoubleClick(self, mb, msg.Params.mouse.shiftstate,
Point(msg.Params.mouse.x, msg.Params.mouse.y));
- end;
+ end
+ else
+ if Assigned(FOnClick) then
+ FOnClick(self);
// The mouse up must still be handled even if we had a double click event.
HandleLMouseUp(msg.Params.mouse.x, msg.Params.mouse.y, msg.Params.mouse.shiftstate);
end;
diff --git a/src/gui/gui_bevel.pas b/src/gui/gui_bevel.pas
index faad992e..ee773819 100644
--- a/src/gui/gui_bevel.pas
+++ b/src/gui/gui_bevel.pas
@@ -51,6 +51,8 @@ type
property Shape: TBevelShape read FBevelShape write SetBevelShape default bsBox;
property Style: TBevelStyle read FBevelStyle write SetBevelStyle default bsRaised;
property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clWindowBackground;
+ property OnClick;
+ property OnDoubleClick;
end;
diff --git a/src/gui/gui_button.pas b/src/gui/gui_button.pas
index ee7e835d..e6973177 100644
--- a/src/gui/gui_button.pas
+++ b/src/gui/gui_button.pas
@@ -71,7 +71,6 @@ type
procedure HandleMouseExit; override;
procedure HandleMouseEnter; override;
public
- OnClick: TNotifyEvent;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure DoPush;
@@ -96,6 +95,7 @@ type
property ShowImage: Boolean read FShowImage write SetShowImage default True;
property OnMouseExit;
property OnMouseEnter;
+ property OnClick;
end;
diff --git a/src/gui/gui_label.pas b/src/gui/gui_label.pas
index efdb9bdb..6f4786b5 100644
--- a/src/gui/gui_label.pas
+++ b/src/gui/gui_label.pas
@@ -65,6 +65,8 @@ type
property Color;
property FontDesc;
property Text;
+ property OnClick;
+ property OnDoubleClick;
property OnMouseEnter;
property OnMouseExit;
property OnMouseDown;