Class SelectionButton
Provides a button-like control that changes focus to a designated previous or next selection button when the arrow keys are pushed.
Inherited Members
Namespace: SadConsole.UI.Controls
Assembly: SadConsole.dll
Syntax
[DataContract]
public class SelectionButton : Button
Constructors
SelectionButton(int, int)
Creates a new Selection Button with a specific width and height.
Declaration
public SelectionButton(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
int | width | The width of the selection button. |
int | height | The height of the selection button. |
Properties
NextSelection
The selection button to focus when the DOWN key is pressed or the SelectNext() method is called.
Declaration
public SelectionButton? NextSelection { get; set; }
Property Value
Type | Description |
---|---|
SelectionButton |
PreviousSelection
The selection button to focus when the UP key is pressed or the SelectPrevious() method is called.
Declaration
public SelectionButton? PreviousSelection { get; set; }
Property Value
Type | Description |
---|---|
SelectionButton |
Methods
ProcessKeyboard(Keyboard)
Focuses the previous or next selection button depending on if the UP or DOWN arrow keys were pressed.
Declaration
public override bool ProcessKeyboard(Keyboard info)
Parameters
Type | Name | Description |
---|---|---|
Keyboard | info | The keyboard state. |
Returns
Type | Description |
---|---|
bool |
Overrides
SelectNext()
Selects the next selection button.
Declaration
public SelectionButton? SelectNext()
Returns
Type | Description |
---|---|
SelectionButton | Returns the next selection button. |
SelectPrevious()
Selects the previous selection button.
Declaration
public SelectionButton? SelectPrevious()
Returns
Type | Description |
---|---|
SelectionButton | Returns the previous selection button. |
SetNextSelection(ref SelectionButton, bool)
Sets the next selection button and optionally sets the previous of the referenced selection to this button.
Declaration
public SelectionButton SetNextSelection(ref SelectionButton nextSelection, bool setPreviousOnNext = true)
Parameters
Type | Name | Description |
---|---|---|
SelectionButton | nextSelection | The selection button to be used as next. |
bool | setPreviousOnNext | Sets the PreviousSelection property on the |
Returns
Type | Description |
---|---|
SelectionButton | The button that was passed to the |