BaseButton
Button activation, toggle state and input signals.
BaseButton defines button behavior; use Button, CheckBox or CheckButton for ready-made visuals. Defaults are ToggleMode = false, Disabled = false, ActionMode = Release and ButtonMask = Left; focus is enabled. ActionMode selects input activation timing rather than delaying programmatic Press.
Separate activation from state. Press immediately activates: ordinary mode calls _Pressed and Pressed; ToggleMode also changes state, reconciles the group and invokes _Toggled/Toggled. Press respects Disabled but does not create ButtonDown/ButtonUp or simulate mouse holding. Attach the same application operation to either a subclass callback or a signal unless two calls are intended.
ButtonPressed/SetPressed only work with ToggleMode = true. A state change invokes Toggled rather than Pressed. Reassigning the same state sends no notification. SetPressedNoSignal only changes local state and redraw: it invokes neither Toggled/_Toggled nor group-peer clearing. After loading a setting this way, explicitly refresh dependent UI.
Disabled blocks Press activation rather than every programmatic state change. SetPressed can change a disabled toggle without its own Toggled; ButtonGroup can still receive Pressed on selection. Do not use a disabled element as the sole synchronization source for your model.
ButtonGroup is for toggle buttons. Assigning its resource neither selects an item nor repairs multiple existing selections. An ordinary SetPressed(true) transition clears peers; SetPressedNoSignal(true) does not. Repeating SetPressed(true) on an already selected item does not restore exclusivity. For initialization, clear every item with SetPressedNoSignal(false), then select one through SetPressed(true); update application state separately if needed.
KeepPressedOutside retains pressed appearance outside bounds rather than permitting activation on outside release. ShortcutFeedback and ShortcutInTooltip configure feedback/tooltip display rather than shortcut enablement. Shortcut invokes Press for a matching non-echo event on a visible button; other controls’ event handling and routing still apply.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
BaseButtonConstructor
public BaseButton();Creates a base button: ToggleMode = false, Disabled = false, ActionMode = Release, ButtonMask = Left, FocusMode = All. Use a derived Button for standard visuals.
Properties10
ActionModeProperty
public BaseButton.ActionModeEnum ActionMode { get; set; }Input activation timing: Press on press, Release on release, default Release. Programmatic Press and Shortcut activation are immediate.
ButtonGroupProperty
public ButtonGroup ButtonGroup { get; set; }Shared toggle-button group resource, or null. Assignment registers membership without selecting a button or repairing existing conflicts. Do not use with ToggleMode = false.
ButtonMaskProperty
public MouseButtonMask ButtonMask { get; set; }Accepted mouse-button bitmask, default Left. Combine MouseButtonMask.Left | MouseButtonMask.Right if needed. Does not disable ui_accept or Shortcut.
ButtonPressedProperty
public bool ButtonPressed { get; set; }Toggle-button state. Setter only works in ToggleMode and emits Toggled on ordinary changes rather than Pressed. For ordinary buttons, IsPressed reflects a press attempt rather than a persistent setting.
DisabledProperty
public bool Disabled { get; set; }Blocks Press activation, default false. Does not forbid programmatic SetPressed; own Toggled/callback are suppressed while disabled. An already selected toggle is not necessarily cleared.
KeepPressedOutsideProperty
public bool KeepPressedOutside { get; set; }Retains pressed appearance when the pointer leaves during holding, default false. Does not allow activation on outside release.
ShortcutProperty
public Shortcut Shortcut { get; set; }Shared Shortcut resource, or null. Assignment enables shortcut processing; a matching non-echo event invokes Press on a visible button. Disabled blocks activation.
ShortcutFeedbackProperty
public bool ShortcutFeedback { get; set; }Show brief visual feedback for Shortcut activation, default true. false does not disable the shortcut itself.
ShortcutInTooltipProperty
public bool ShortcutInTooltip { get; set; }Include Shortcut information in the standard tooltip, default true. Does not enable/disable shortcut handling; custom tooltips can be supplied separately.
ToggleModeProperty
public bool ToggleMode { get; set; }Retain on/off state, default false. CheckBox/CheckButton enable this in their constructors. Disabling the mode first clears toggle state through the ordinary setter and can emit Toggled.
Methods26
GetActionModeBaseButton.ActionModeEnum
public BaseButton.ActionModeEnum GetActionMode();Input activation timing: Press on press, Release on release, default Release. Programmatic Press and Shortcut activation are immediate.
BaseButton.ActionModeEnumStored input-activation timing mode.
GetButtonGroupButtonGroup
public ButtonGroup GetButtonGroup();Shared toggle-button group resource, or null. Assignment registers membership without selecting a button or repairing existing conflicts. Do not use with ToggleMode = false.
ButtonGroupShared ButtonGroup, or null.
GetButtonMaskMouseButtonMask
public MouseButtonMask GetButtonMask();Accepted mouse-button bitmask, default Left. Combine MouseButtonMask.Left | MouseButtonMask.Right if needed. Does not disable ui_accept or Shortcut.
MouseButtonMaskMouseButtonMask bitmask.
GetDrawModeBaseButton.DrawMode
public BaseButton.DrawMode GetDrawMode();Returns logical Normal/Pressed/Hover/Disabled/HoverPressed drawing mode, accounting for interaction and shortcut feedback. Neither a theme setter nor stored ButtonPressed.
BaseButton.DrawModeCurrent logical BaseButton.DrawMode.
GetShortcutShortcut
public Shortcut GetShortcut();Shared Shortcut resource, or null. Assignment enables shortcut processing; a matching non-echo event invokes Press on a visible button. Disabled blocks activation.
ShortcutShared Shortcut, or null.
IsDisabledbool
public bool IsDisabled();Blocks Press activation, default false. Does not forbid programmatic SetPressed; own Toggled/callback are suppressed while disabled. An already selected toggle is not necessarily cleared.
booltrue when activation is disabled.
IsHoveredbool
public bool IsHovered();Returns hover state tracked by UI events. Not a test of an arbitrary global coordinate or keyboard focus.
booltrue for tracked pointer hover.
IsKeepPressedOutsidebool
public bool IsKeepPressedOutside();Retains pressed appearance when the pointer leaves during holding, default false. Does not allow activation on outside release.
booltrue when pressed appearance is retained outside during holding.
IsPressedbool
public bool IsPressed();Toggle-button state. Setter only works in ToggleMode and emits Toggled on ordinary changes rather than Pressed. For ordinary buttons, IsPressed reflects a press attempt rather than a persistent setting.
boolToggle state, or a current ordinary-button press attempt.
IsShortcutFeedbackbool
public bool IsShortcutFeedback();Show brief visual feedback for Shortcut activation, default true. false does not disable the shortcut itself.
booltrue when visual shortcut feedback is enabled.
IsShortcutInTooltipEnabledbool
public bool IsShortcutInTooltipEnabled();Include Shortcut information in the standard tooltip, default true. Does not enable/disable shortcut handling; custom tooltips can be supplied separately.
booltrue when shortcut information is enabled in tooltips.
IsToggleModebool
public bool IsToggleMode();Retain on/off state, default false. CheckBox/CheckButton enable this in their constructors. Disabling the mode first clears toggle state through the ordinary setter and can emit Toggled.
booltrue for persistent toggle-state mode.
Pressvoid
public void Press();Immediately activates, respecting Disabled. In toggle mode changes state and reconciles the group, then invokes Toggled and Pressed. Does not create ButtonDown/ButtonUp or require physical input. Re-activating a mandatory group selection can retain true while notifying again.
SetActionModevoid
public void SetActionMode(BaseButton.ActionModeEnum mode);Input activation timing: Press on press, Release on release, default Release. Programmatic Press and Shortcut activation are immediate.
| Name | Type | Default |
|---|---|---|
mode | BaseButton.ActionModeEnum | — |
modeInput activation timing: Press on press, Release on release, default Release. Programmatic Press and Shortcut activation are immediate.
SetButtonGroupvoid
public void SetButtonGroup(ButtonGroup buttonGroup);Shared toggle-button group resource, or null. Assignment registers membership without selecting a button or repairing existing conflicts. Do not use with ToggleMode = false.
| Name | Type | Default |
|---|---|---|
buttonGroup | ButtonGroup | — |
buttonGroupShared toggle-button group resource, or null. Assignment registers membership without selecting a button or repairing existing conflicts. Do not use with ToggleMode = false.
SetButtonMaskvoid
public void SetButtonMask(MouseButtonMask mask);Accepted mouse-button bitmask, default Left. Combine MouseButtonMask.Left | MouseButtonMask.Right if needed. Does not disable ui_accept or Shortcut.
| Name | Type | Default |
|---|---|---|
mask | MouseButtonMask | — |
maskAccepted mouse-button bitmask, default Left. Combine MouseButtonMask.Left | MouseButtonMask.Right if needed. Does not disable ui_accept or Shortcut.
SetDisabledvoid
public void SetDisabled(bool disabled);Blocks Press activation, default false. Does not forbid programmatic SetPressed; own Toggled/callback are suppressed while disabled. An already selected toggle is not necessarily cleared.
| Name | Type | Default |
|---|---|---|
disabled | bool | — |
disabledBlocks Press activation, default false. Does not forbid programmatic SetPressed; own Toggled/callback are suppressed while disabled. An already selected toggle is not necessarily cleared.
SetKeepPressedOutsidevoid
public void SetKeepPressedOutside(bool enabled);Retains pressed appearance when the pointer leaves during holding, default false. Does not allow activation on outside release.
| Name | Type | Default |
|---|---|---|
enabled | bool | — |
enabledRetains pressed appearance when the pointer leaves during holding, default false. Does not allow activation on outside release.
SetPressedvoid
public void SetPressed(bool pressed);Toggle-button state. Setter only works in ToggleMode and emits Toggled on ordinary changes rather than Pressed. For ordinary buttons, IsPressed reflects a press attempt rather than a persistent setting.
| Name | Type | Default |
|---|---|---|
pressed | bool | — |
pressedRequested toggle state; ignored without ToggleMode.
SetPressedNoSignalvoid
public void SetPressedNoSignal(bool pressed);Changes state only in ToggleMode without Toggled/_Toggled, Pressed or group signals. Does not clear ButtonGroup peers and can create multiple selections. Explicitly refresh dependent application state.
| Name | Type | Default |
|---|---|---|
pressed | bool | — |
pressedRequested toggle state; ignored without ToggleMode.
SetShortcutvoid
public void SetShortcut(Shortcut shortcut);Shared Shortcut resource, or null. Assignment enables shortcut processing; a matching non-echo event invokes Press on a visible button. Disabled blocks activation.
| Name | Type | Default |
|---|---|---|
shortcut | Shortcut | — |
shortcutShared Shortcut resource, or null. Assignment enables shortcut processing; a matching non-echo event invokes Press on a visible button. Disabled blocks activation.
SetShortcutFeedbackvoid
public void SetShortcutFeedback(bool enabled);Show brief visual feedback for Shortcut activation, default true. false does not disable the shortcut itself.
| Name | Type | Default |
|---|---|---|
enabled | bool | — |
enabledShow brief visual feedback for Shortcut activation, default true. false does not disable the shortcut itself.
SetShortcutInTooltipvoid
public void SetShortcutInTooltip(bool enabled);Include Shortcut information in the standard tooltip, default true. Does not enable/disable shortcut handling; custom tooltips can be supplied separately.
| Name | Type | Default |
|---|---|---|
enabled | bool | — |
enabledInclude Shortcut information in the standard tooltip, default true. Does not enable/disable shortcut handling; custom tooltips can be supplied separately.
SetToggleModevoid
public void SetToggleMode(bool enabled);Retain on/off state, default false. CheckBox/CheckButton enable this in their constructors. Disabling the mode first clears toggle state through the ordinary setter and can emit Toggled.
| Name | Type | Default |
|---|---|---|
enabled | bool | — |
enabledRetain on/off state, default false. CheckBox/CheckButton enable this in their constructors. Disabling the mode first clears toggle state through the ordinary setter and can emit Toggled.
_Pressedvoid
public virtual void _Pressed();Subclass virtual activation callback before Pressed. Not invoked by ordinary toggle-state assignment. Do not call it instead of Press to simulate activation.
_Toggledvoid
public virtual void _Toggled(bool toggledOn);Virtual callback before Toggled on toggle-state notification. SetPressedNoSignal and Disabled suppress it; notification count need not equal the number of state transitions.
| Name | Type | Default |
|---|---|---|
toggledOn | bool | — |
toggledOnNotified toggle state; true can repeat without a transition in a mandatory-selection group.
Signals and events4
ButtonDownEvent
public event Action ButtonDown;Beginning of accepted holding through input. Not final activation or programmatic Press. Pressed timing separately depends on ActionMode.
ButtonUpEvent
public event Action ButtonUp;End of accepted input holding; disabling an active button can also end it. Does not guarantee activation and is not generated by programmatic Press.
PressedEvent
public event Action Pressed;Button activated through user input or Press. Ordinary SetPressed/SetPressedNoSignal do not emit it. Use Toggled and ButtonPressed for toggle state.
ToggledEvent
public event BaseButton.ToggledEventHandler Toggled;Toggle-state notification. An ordinary changed SetPressed emits it; SetPressedNoSignal and Disabled suppress it. Press on a mandatory group’s selected button can report true again without a state change.
| Name | Type | Default |
|---|---|---|
toggledOn | bool | — |
toggledOnNotified toggle state; true can repeat without a transition in a mandatory-selection group.
BaseButton.ActionModeEnum
| Value | Description |
|---|---|
Press = 0 | Require just a press to consider the button clicked. |
Release = 1 | Require a press and a subsequent release before considering the button clicked. |
BaseButton.DrawMode
| Value | Description |
|---|---|
Disabled = 3 | The state of buttons are disabled. |
Hover = 2 | The state of buttons are hovered. |
HoverPressed = 4 | The state of buttons are both hovered and pressed. |
Normal = 0 | The normal state (i.e. not pressed, not hovered, not toggled and enabled) of buttons. |
Pressed = 1 | The state of buttons are pressed. |
Theme properties
These are Theme resource keys, not C# properties. Use the matching Control GetTheme…() and AddTheme…Override() methods for each value type.
| Key and type | Description |
|---|---|
click_marginint | Defines the margin around the button's area that still counts as a valid click. This is useful to make it easier to click small buttons. Default:0 |
focus_soundAudioStream | Played when this |
hover_soundAudioStream | Played when the button is hovered with the mouse. |
pressed_disabled_soundAudioStream | Played when the button is pressed with any input method, but has |
pressed_soundAudioStream | Played when the button is pressed with any input method. |