Преглед изворни кода

Fixes #986. Comparing with ShortcutHelper.GetModifiersKey in the demo.cs

BDisp пре 4 година
родитељ
комит
c53acea225
2 измењених фајлова са 4 додато и 2 уклоњено
  1. 3 1
      Example/demo.cs
  2. 1 1
      FSharpExample/Program.fs

+ 3 - 1
Example/demo.cs

@@ -689,12 +689,14 @@ static class Demo {
 
 
 	private static void Win_KeyPress (View.KeyEventEventArgs e)
 	private static void Win_KeyPress (View.KeyEventEventArgs e)
 	{
 	{
-		if ((e.KeyEvent.Key & (Key.CtrlMask | Key.T)) != 0) {
+		switch (ShortcutHelper.GetModifiersKey (e.KeyEvent)) {
+		case Key.CtrlMask | Key.T:
 			if (menu.IsMenuOpen)
 			if (menu.IsMenuOpen)
 				menu.CloseMenu ();
 				menu.CloseMenu ();
 			else
 			else
 				menu.OpenMenu ();
 				menu.OpenMenu ();
 			e.Handled = true;
 			e.Handled = true;
+			break;
 		}
 		}
 	}
 	}
 }
 }

+ 1 - 1
FSharpExample/Program.fs

@@ -425,7 +425,7 @@ let Main () =
         StatusItem(Key.F1, ustr "~F1~ Help", Action Help)
         StatusItem(Key.F1, ustr "~F1~ Help", Action Help)
         StatusItem(Key.F2, ustr "~F2~ Load", Action Load)
         StatusItem(Key.F2, ustr "~F2~ Load", Action Load)
         StatusItem(Key.F3, ustr "~F3~ Save", Action Save)
         StatusItem(Key.F3, ustr "~F3~ Save", Action Save)
-        StatusItem(Key.ControlQ, ustr "~^Q~ Quit", fun () -> if (Quit()) then top.Running <- false) |])
+        StatusItem(Key.Q, ustr "~^Q~ Quit", fun () -> if (Quit()) then top.Running <- false) |])
     win.Add (drag, dragText)
     win.Add (drag, dragText)
     let bottom = new Label (ustr "This should go on the bottom of the same top-level!")
     let bottom = new Label (ustr "This should go on the bottom of the same top-level!")
     win.Add bottom
     win.Add bottom