summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2010-08-18 22:11:35 +0200
committerGraeme Geldenhuys <graemeg@gmail.com>2010-08-18 22:11:35 +0200
commita33aa25be6f67043ab587741f4ce28377d5584fb (patch)
treecbe7fd47e8d5799dadbfb97bd816a1dfe0a07a0e /src
parentf51cd5279905690dfe385c33dff3af19fc25fb40 (diff)
downloadfpGUI-a33aa25be6f67043ab587741f4ce28377d5584fb.tar.xz
MenuBar: fixed menu selectio/focus issue
* Menubar is not focusable, so our check for Is Focusable will never be true. * Menubar now has normal behaviour again. When you click, a menu opens, click again and menu closes. * Click to open menu and then move mouse over other menus, opens other popup menus. I can't believe this bug was over a year old!!! :-/
Diffstat (limited to 'src')
-rw-r--r--src/gui/fpg_menu.pas25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/gui/fpg_menu.pas b/src/gui/fpg_menu.pas
index 06e64b6f..2815d84d 100644
--- a/src/gui/fpg_menu.pas
+++ b/src/gui/fpg_menu.pas
@@ -150,6 +150,7 @@ type
FMenuOptions: TfpgMenuOptions;
FPrevFocusItem: integer;
FFocusItem: integer;
+ FClicked: Boolean;
procedure SetFocusItem(const AValue: integer);
procedure DoSelect;
procedure CloseSubmenus;
@@ -420,11 +421,10 @@ begin
end
else
begin
- if not Focused then
- Exit;
+ if not FClicked then
+ exit;
end;
-
newf := CalcMouseCol(x);
if not VisibleItem(newf).Selectable then
Exit; //==>
@@ -452,15 +452,17 @@ begin
if ComponentCount = 0 then
Exit; // We have no menu items in MainMenu.
+
+ FClicked := not FClicked;
- if not Focused then
- ActivateMenu;
- //else
- //begin
- //CloseSubmenus;
- //DeActivateMenu;
- //Exit; //==>
- //end;
+ if FClicked then
+ ActivateMenu
+ else
+ begin
+ CloseSubmenus;
+ DeActivateMenu;
+ exit; //==>
+ end;
newf := CalcMouseCol(x);
@@ -532,6 +534,7 @@ begin
FFocusItem := -1;
FPrevFocusItem := -1;
FFocusable := False;
+ FClicked := False;
FBackgroundColor := Parent.BackgroundColor;
FTextColor := Parent.TextColor;
// calculate the best height based on font