Tig 10 mēneši atpakaļ
vecāks
revīzija
a38a96a3cb
2 mainītis faili ar 23 papildinājumiem un 11 dzēšanām
  1. 1 1
      Terminal.Gui/Views/CheckBox.cs
  2. 22 10
      Terminal.Gui/Views/Label.cs

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

@@ -3,7 +3,7 @@ using System.Reflection.Metadata;
 
 namespace Terminal.Gui;
 
-/// <summary>Shows a check box that can be cycled between three states.</summary>
+/// <summary>Shows a check box that can be cycled between two or three states.</summary>
 public class CheckBox : View
 {
     /// <summary>

+ 22 - 10
Terminal.Gui/Views/Label.cs

@@ -1,12 +1,23 @@
 namespace Terminal.Gui;
 
 /// <summary>
-///     The Label <see cref="View"/> displays a string at a given position and supports multiple lines separated by
-///     newline characters. Multi-line Labels support word wrap.
+///     The Label <see cref="View"/> displays text that describes the View next in the <see cref="View.Subviews"/>. When
+///     Label
+///     recieves a <see cref="Command.HotKey"/> command it will pass it to the next <see cref="View"/> in
+///     <see cref="View.Subviews"/>.
 /// </summary>
 /// <remarks>
-///     The <see cref="Label"/> view is functionality identical to <see cref="View"/> and is included for API
-///     backwards compatibility.
+///     <para>
+///         <see cref="Label.Title"/> and <see cref="Label.Text"/> are the same property. When <see cref="Label.Title"/> is
+///         set
+///         <see cref="Label.Text"/> is also set. When <see cref="Label.Text"/> is set <see cref="Label.Title"/> is also
+///         set.
+///     </para>
+///     <para>
+///         If <see cref="Label.CanFocus"/> is <see langword="false"/> and the use clicks on the Label,
+///         the <see cref="Command.HotKey"/> will be invoked on the next <see cref="View"/> in
+///         <see cref="View.Subviews"/>."
+///     </para>
 /// </remarks>
 public class Label : View
 {
@@ -17,7 +28,7 @@ public class Label : View
         Width = Dim.Auto (DimAutoStyle.Text);
 
         // Things this view knows how to do
-        AddCommand (Command.HotKey, context =>  InvokeHotKeyOnNext(context));
+        AddCommand (Command.HotKey, InvokeHotKeyOnNext);
 
         TitleChanged += Label_TitleChanged;
         MouseClick += Label_MouseClick;
@@ -37,14 +48,14 @@ public class Label : View
         TextFormatter.HotKeySpecifier = HotKeySpecifier;
     }
 
-    /// <inheritdoc />
+    /// <inheritdoc/>
     public override string Text
     {
-        get => base.Title;
-        set => base.Text = base.Title = value;
+        get => Title;
+        set => base.Text = Title = value;
     }
 
-    /// <inheritdoc />
+    /// <inheritdoc/>
     public override Rune HotKeySpecifier
     {
         get => base.HotKeySpecifier;
@@ -54,9 +65,10 @@ public class Label : View
     private bool? InvokeHotKeyOnNext (CommandContext context)
     {
         int me = SuperView?.Subviews.IndexOf (this) ?? -1;
+
         if (me != -1 && me < SuperView?.Subviews.Count - 1)
         {
-            SuperView?.Subviews [me + 1].InvokeCommand(Command.HotKey, context.Key, context.KeyBinding);
+            SuperView?.Subviews [me + 1].InvokeCommand (Command.HotKey, context.Key, context.KeyBinding);
         }
 
         return true;