diff options
-rw-r--r-- | src/gui/fpg_menu.pas | 25 |
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 |