summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2010-05-15 12:06:27 +0200
committerGraeme Geldenhuys <graemeg@gmail.com>2010-05-15 12:06:27 +0200
commit3462bf3497331271af6a05de12a2f96c804d1289 (patch)
tree7e4082fe22167e6c6f6c6b6d3cddb02b2ed82901
parentb12173f417a04d85713ea392ef6378ee9168a847 (diff)
downloadfpGUI-3462bf3497331271af6a05de12a2f96c804d1289.tar.xz
When using ICommand (aka actions) it takes preferences over OnClick event handler.
-rw-r--r--src/gui/fpg_button.pas4
-rw-r--r--src/gui/fpg_menu.pas4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/fpg_button.pas b/src/gui/fpg_button.pas
index ebfa8b49..7fae3b75 100644
--- a/src/gui/fpg_button.pas
+++ b/src/gui/fpg_button.pas
@@ -714,7 +714,9 @@ begin
if pform <> nil then
pform.ModalResult := ModalResult;
- if Assigned(OnClick) then
+ if Assigned(FCommand) then // ICommand takes preference to OnClick
+ FCommand.Execute
+ else if Assigned(OnClick) then
OnClick(self);
end;
diff --git a/src/gui/fpg_menu.pas b/src/gui/fpg_menu.pas
index 94c9317a..3842af15 100644
--- a/src/gui/fpg_menu.pas
+++ b/src/gui/fpg_menu.pas
@@ -270,7 +270,9 @@ end;
procedure TfpgMenuItem.Click;
begin
- if Assigned(FOnClick) then
+ if Assigned(FCommand) then // ICommand takes preference over OnClick
+ FCommand.Execute
+ else if Assigned(FOnClick) then
FOnClick(self);
end;