Show / Hide Table of Contents

Class Button

Button is a view that provides an item that invokes a callback when activated.

Inheritance
System.Object
Responder
View
Button
Inherited Members
Responder.CanFocus
View.Add(View)
View.Add(View[])
View.AddRune(Int32, Int32, Rune)
View.Bounds
View.ChildNeedsDisplay()
View.Clear()
View.Clear(Rect)
View.ClearNeedsDisplay()
View.ClipToBounds()
View.ColorScheme
View.DrawFrame(Rect, Int32, Boolean)
View.DrawHotString(ustring, Boolean, ColorScheme)
View.DrawHotString(ustring, Attribute, Attribute)
View.Driver
View.EnsureFocus()
View.Focused
View.FocusFirst()
View.FocusLast()
View.FocusNext()
View.FocusPrev()
View.Frame
View.GetEnumerator()
View.HasFocus
View.Height
View.Id
View.LayoutStyle
View.LayoutSubviews()
View.MostFocused
View.Move(Int32, Int32)
View.Remove(View)
View.RemoveAll()
View.ScreenToView(Int32, Int32)
View.SetClip(Rect)
View.SetFocus(View)
View.SetNeedsDisplay()
View.SetNeedsDisplay(Rect)
View.Subviews
View.SuperView
View.ToString()
View.WantMousePositionReports
View.Width
View.X
View.Y
Namespace: Terminal.Gui
Assembly: Terminal.Gui.dll
Syntax
public class Button : Terminal.Gui.View
Remarks

Provides a button that can be clicked, or pressed with the enter key and processes hotkeys (the first uppercase letter in the button becomes the hotkey).

If the button is configured as the default (IsDefault) the button will respond to the return key is no other view processes it, and turns this into a clicked event.

Constructors

Button(ustring, Boolean)

Public constructor, creates a button based on the given text at position 0,0

Declaration
public Button (NStack.ustring text, bool is_default = false);
Parameters
Type Name Description
NStack.ustring text

The button's text

System.Boolean is_default

If set, this makes the button the default button in the current view, which means that if the user presses return on a view that does not handle return, it will be treated as if he had clicked on the button

Remarks

The size of the button is computed based on the text length. This button is not a default button.

Button(Int32, Int32, ustring)

Public constructor, creates a button based on the given text at the given position.

Declaration
public Button (int x, int y, NStack.ustring text);
Parameters
Type Name Description
System.Int32 x

X position where the button will be shown.

System.Int32 y

Y position where the button will be shown.

NStack.ustring text

The button's text

Remarks

The size of the button is computed based on the text length. This button is not a default button.

Button(Int32, Int32, ustring, Boolean)

Public constructor, creates a button based on the given text at the given position.

Declaration
public Button (int x, int y, NStack.ustring text, bool is_default);
Parameters
Type Name Description
System.Int32 x

X position where the button will be shown.

System.Int32 y

Y position where the button will be shown.

NStack.ustring text

The button's text

System.Boolean is_default

If set, this makes the button the default button in the current view, which means that if the user presses return on a view that does not handle return, it will be treated as if he had clicked on the button

Remarks

If the value for is_default is true, a special decoration is used, and the enter key on a dialog would implicitly activate this button.

Fields

Clicked

Clicked event, raised when the button is clicked.

Declaration
public Action Clicked;
Field Value
Type Description
System.Action

To be added.

Remarks

Client code can hook up to this event, it is raised when the button is activated either with the mouse or the keyboard.

Properties

IsDefault

Gets or sets a value indicating whether this Button is the default action to activate on return on a dialog.

Declaration
public bool IsDefault { get; set; }
Property Value
Type Description
System.Boolean

true if is default; otherwise, false.

Text

The text displayed by this widget.

Declaration
public NStack.ustring Text { get; set; }
Property Value
Type Description
NStack.ustring

To be added.

Methods

MouseEvent(MouseEvent)

Declaration
public override bool MouseEvent (Terminal.Gui.MouseEvent me);
Parameters
Type Name Description
MouseEvent me

To be added.

Returns
Type Description
System.Boolean

To be added.

PositionCursor()

Declaration
public override void PositionCursor ();

ProcessColdKey(KeyEvent)

Declaration
public override bool ProcessColdKey (Terminal.Gui.KeyEvent kb);
Parameters
Type Name Description
KeyEvent kb

To be added.

Returns
Type Description
System.Boolean

To be added.

ProcessHotKey(KeyEvent)

Declaration
public override bool ProcessHotKey (Terminal.Gui.KeyEvent kb);
Parameters
Type Name Description
KeyEvent kb

To be added.

Returns
Type Description
System.Boolean

To be added.

ProcessKey(KeyEvent)

Declaration
public override bool ProcessKey (Terminal.Gui.KeyEvent kb);
Parameters
Type Name Description
KeyEvent kb

To be added.

Returns
Type Description
System.Boolean

To be added.

Redraw(Rect)

Declaration
public override void Redraw (Terminal.Gui.Rect region);
Parameters
Type Name Description
Rect region

To be added.

Back to top Copyright © 2015-2017 Microsoft
Generated by DocFX