瀏覽代碼

View.OnMouseClick now Can/Setfocus.

Label now uses Command.HotKey on MouseClick
Tig 1 年之前
父節點
當前提交
348c0dc199
共有 2 個文件被更改,包括 6 次插入1 次删除
  1. 5 0
      Terminal.Gui/View/ViewMouse.cs
  2. 1 1
      Terminal.Gui/Views/Label.cs

+ 5 - 0
Terminal.Gui/View/ViewMouse.cs

@@ -146,6 +146,11 @@ public partial class View
             return true;
         }
 
+        if (!HasFocus && CanFocus)
+        {
+            SetFocus ();
+        }
+
         return args.Handled;
     }
 }

+ 1 - 1
Terminal.Gui/Views/Label.cs

@@ -30,7 +30,7 @@ public class Label : View
 
     private void Label_MouseClick (object sender, MouseEventEventArgs e)
     {
-        e.Handled = InvokeCommand (Command.Accept) == true;
+        e.Handled = InvokeCommand (Command.HotKey) == true;
     }
 
     private void Label_TitleChanged (object sender, StateEventArgs<string> e)