|
@@ -7,18 +7,23 @@
|
|
|
|
|
|
namespace Terminal.Gui;
|
|
|
|
|
|
-/// <summary>Button is a <see cref="View"/> that provides an item that invokes raises the <see cref="View.Accept"/> event.</summary>
|
|
|
+/// <summary>
|
|
|
+/// A View that raises the <see cref="View.Accept"/> event when clicked with the mouse or when the
|
|
|
+/// <see cref="View.HotKey"/>, <c>Enter</c>, or <c>Space</c> key is pressed.
|
|
|
+/// </summary>
|
|
|
/// <remarks>
|
|
|
/// <para>
|
|
|
/// Provides a button showing text that raises the <see cref="View.Accept"/> event when clicked on with a mouse or
|
|
|
-/// when the user presses SPACE, ENTER, or the <see cref="View.HotKey"/>. The hot key is the first letter or digit
|
|
|
+/// when the user presses <c>Enter</c>, <c>Space</c> or the <see cref="View.HotKey"/>. The hot key is the first
|
|
|
+/// letter or digit
|
|
|
/// following the first underscore ('_') in the button text.
|
|
|
/// </para>
|
|
|
/// <para>Use <see cref="View.HotKeySpecifier"/> to change the hot key specifier from the default of ('_').</para>
|
|
|
/// <para>
|
|
|
-/// When the button is configured as the default (<see cref="IsDefault"/>) and the user presses the ENTER key, if
|
|
|
-/// no other <see cref="View"/> processes the key, the <see cref="Button"/>'s <see cref="View.Accept"/> event will
|
|
|
-/// be fired.
|
|
|
+/// When the button is configured as the default (<see cref="IsDefault"/>) and the user causes the button to be
|
|
|
+/// accepted the <see cref="Button"/>'s <see cref="View.Accept"/> event will be raised. If the Accept event is not
|
|
|
+/// handled, the Accept event on the <see cref="View.SuperView"/>. will be raised. This enables default Accept
|
|
|
+/// behavior.
|
|
|
/// </para>
|
|
|
/// <para>
|
|
|
/// Set <see cref="View.WantContinuousButtonPressed"/> to <see langword="true"/> to have the
|
|
@@ -78,7 +83,7 @@ public class Button : View, IDesignable
|
|
|
|
|
|
SetFocus ();
|
|
|
|
|
|
- // TODO: If `IsDefault` were a property on `View` *any* View could work this way. That's theoretical as
|
|
|
+ // TODO: If `IsDefault` were a property on `View` *any* View could work this way. That's theoretical as
|
|
|
// TODO: no use-case has been identified for any View other than Button to act like this.
|
|
|
// If Accept was not handled...
|
|
|
if (cachedIsDefault && SuperView is { })
|
|
@@ -150,9 +155,12 @@ public class Button : View, IDesignable
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// Gets or sets whether the <see cref="Button"/> will show an indicator indicating it is the default Button. If <see langword="true"/>
|
|
|
- /// <see cref="Command.Accept"/> will be invoked when the user presses <c>Enter</c> and no other peer-<see cref="View"/> processes the key.
|
|
|
- /// If <see cref="View.Accept"/> is not handled, the Gets or sets whether the <see cref="Button"/> will show an indicator indicating it is the default Button. If <see langword="true"/>
|
|
|
+ /// Gets or sets whether the <see cref="Button"/> will show an indicator indicating it is the default Button. If
|
|
|
+ /// <see langword="true"/>
|
|
|
+ /// <see cref="Command.Accept"/> will be invoked when the user presses <c>Enter</c> and no other peer-
|
|
|
+ /// <see cref="View"/> processes the key.
|
|
|
+ /// If <see cref="View.Accept"/> is not handled, the Gets or sets whether the <see cref="Button"/> will show an
|
|
|
+ /// indicator indicating it is the default Button. If <see langword="true"/>
|
|
|
/// <see cref="Command.Accept"/> command on the <see cref="View.SuperView"/> will be invoked.
|
|
|
/// </summary>
|
|
|
public bool IsDefault
|