diff --git a/Terminal.Gui/Core.cs b/Terminal.Gui/Core.cs
index 7168eba1e..ed42bf590 100644
--- a/Terminal.Gui/Core.cs
+++ b/Terminal.Gui/Core.cs
@@ -1643,8 +1643,8 @@ namespace Terminal.Gui {
nx = Math.Max (x, 0);
nx = nx + top.Frame.Width > Driver.Cols ? Math.Max (Driver.Cols - top.Frame.Width, 0) : nx;
bool m, s;
- if (SuperView == null)
- m = Application.Top.MenuBar != null;
+ if (SuperView == null || SuperView.GetType() != typeof(Toplevel))
+ m = Application.Top.HasMenuBar;
else
m = ((Toplevel)SuperView).MenuBar != null;
int l = m ? 1 : 0;
diff --git a/Terminal.Gui/Views/Menu.cs b/Terminal.Gui/Views/Menu.cs
index 16fdad686..d6438a8a4 100644
--- a/Terminal.Gui/Views/Menu.cs
+++ b/Terminal.Gui/Views/Menu.cs
@@ -360,7 +360,7 @@ namespace Terminal.Gui {
public override bool ProcessHotKey (KeyEvent keyEvent)
{
// To ncurses simulate a AltMask key pressing Alt+Space because
- // it can´t detect an alone special key down was pressed.
+ // it can�t detect an alone special key down was pressed.
if (keyEvent.IsAlt && keyEvent.Key == Key.AltMask) {
OnKeyDown (keyEvent);
return true;
@@ -562,6 +562,8 @@ namespace Terminal.Gui {
}
bool openedByAltKey;
+
+ ///
public override bool OnKeyDown (KeyEvent keyEvent)
{
if (keyEvent.IsAlt) {
@@ -572,12 +574,7 @@ namespace Terminal.Gui {
return false;
}
- ///
- /// Track Alt key-up events. On Windows, when a user releases Alt (without another key), the menu gets focus but doesn't open.
- /// We mimic that behavior here.
- ///
- ///
- ///
+ ///
public override bool OnKeyUp (KeyEvent keyEvent)
{
if (keyEvent.IsAlt) {
@@ -999,7 +996,7 @@ namespace Terminal.Gui {
}
// To ncurses simulate a AltMask key pressing Alt+Space because
- // it can´t detect an alone special key down was pressed.
+ // it can�t detect an alone special key down was pressed.
if (kb.IsAlt && kb.Key == Key.AltMask && openMenu == null) {
OnKeyDown (kb);
OnKeyUp (kb);
diff --git a/UICatalog/Program.cs b/UICatalog/Program.cs
index 14a7956db..7d3afc977 100644
--- a/UICatalog/Program.cs
+++ b/UICatalog/Program.cs
@@ -148,7 +148,9 @@ namespace UICatalog {
}
_top = Application.Top;
- _top.OnKeyUp += KeyUpHandler;
+
+ _top.KeyUp += KeyUpHandler;
+
_top.Add (_menu);
_top.Add (_leftPane);
_top.Add (_rightPane);
@@ -235,7 +237,7 @@ namespace UICatalog {
/// to not be impacted. Same as for tabs.
///
///
- private static void KeyUpHandler (KeyEvent ke)
+ private static void KeyUpHandler (object sender, View.KeyEventEventArgs a)
{
if (_runningScenario != null) {
//switch (ke.Key) {
@@ -244,8 +246,8 @@ namespace UICatalog {
// break;
//case Key.Enter:
// break;
- //}
- } else if (ke.Key == Key.Tab || ke.Key == Key.BackTab) {
+ //}<
+ } else if (a.KeyEvent.Key == Key.Tab || a.KeyEvent.Key == Key.BackTab) {
// BUGBUG: Work around Issue #434 by implementing our own TAB navigation
if (_top.MostFocused == _categoryListView)
_top.SetFocus (_rightPane);
diff --git a/UICatalog/Scenarios/Keys.cs b/UICatalog/Scenarios/Keys.cs
index 1d28f9e8e..3584709b6 100644
--- a/UICatalog/Scenarios/Keys.cs
+++ b/UICatalog/Scenarios/Keys.cs
@@ -43,8 +43,8 @@ namespace UICatalog {
public override bool ProcessColdKey (KeyEvent keyEvent)
{
_processColdKeyList.Add (keyEvent.ToString ());
- return base.ProcessHotKey (keyEvent);
+ return base.ProcessColdKey (keyEvent);
}
}
@@ -92,7 +92,7 @@ namespace UICatalog {
};
Win.Add (labelKeypress);
- Win.OnKeyPress += (KeyEvent keyEvent) => labelKeypress.Text = keyEvent.ToString ();
+ Win.KeyPress += (sender, a) => labelKeypress.Text = a.KeyEvent.ToString ();
// Key stroke log:
var keyLogLabel = new Label ("Key stroke log:") {
@@ -119,9 +119,9 @@ namespace UICatalog {
keyStrokeListView.MoveDown ();
}
- Win.OnKeyDown += (KeyEvent keyEvent) => KeyDownPressUp (keyEvent, "Down");
- Win.OnKeyPress += (KeyEvent keyEvent) => KeyDownPressUp (keyEvent, "Press");
- Win.OnKeyUp += (KeyEvent keyEvent) => KeyDownPressUp (keyEvent, "Up");
+ Win.KeyDown += (sender, a) => KeyDownPressUp (a.KeyEvent, "Down");
+ Win.KeyPress += (sender, a) => KeyDownPressUp (a.KeyEvent, "Press");
+ Win.KeyUp += (sender, a) => KeyDownPressUp (a.KeyEvent, "Up");
// ProcessKey log:
// BUGBUG: Label is not positioning right with Pos, so using TextField instead