reckfellENGINE

BaseButton

Button activation, toggle state and input signals.

On this page
class BaseButtonReckfellSharpInherits Control

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
# BaseButton
C#
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
# ActionMode
C#
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
# ButtonGroup
C#
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
# ButtonMask
C#
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
# ButtonPressed
C#
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
# Disabled
C#
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
# KeepPressedOutside
C#
public bool KeepPressedOutside { get; set; }

Retains pressed appearance when the pointer leaves during holding, default false. Does not allow activation on outside release.

ShortcutProperty
# Shortcut
C#
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
# ShortcutFeedback
C#
public bool ShortcutFeedback { get; set; }

Show brief visual feedback for Shortcut activation, default true. false does not disable the shortcut itself.

ShortcutInTooltipProperty
# ShortcutInTooltip
C#
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
# ToggleMode
C#
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
# GetActionMode
C#
public BaseButton.ActionModeEnum GetActionMode();

Input activation timing: Press on press, Release on release, default Release. Programmatic Press and Shortcut activation are immediate.

Returns BaseButton.ActionModeEnum

Stored input-activation timing mode.

GetButtonGroupButtonGroup
# GetButtonGroup
C#
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.

Returns ButtonGroup

Shared ButtonGroup, or null.

GetButtonMaskMouseButtonMask
# GetButtonMask
C#
public MouseButtonMask GetButtonMask();

Accepted mouse-button bitmask, default Left. Combine MouseButtonMask.Left | MouseButtonMask.Right if needed. Does not disable ui_accept or Shortcut.

Returns MouseButtonMask

MouseButtonMask bitmask.

GetDrawModeBaseButton.DrawMode
# GetDrawMode
C#
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.

Returns BaseButton.DrawMode

Current logical BaseButton.DrawMode.

GetShortcutShortcut
# GetShortcut
C#
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.

Returns Shortcut

Shared Shortcut, or null.

IsDisabledbool
# IsDisabled
C#
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.

Returns bool

true when activation is disabled.

IsHoveredbool
# IsHovered
C#
public bool IsHovered();

Returns hover state tracked by UI events. Not a test of an arbitrary global coordinate or keyboard focus.

Returns bool

true for tracked pointer hover.

IsKeepPressedOutsidebool
# IsKeepPressedOutside
C#
public bool IsKeepPressedOutside();

Retains pressed appearance when the pointer leaves during holding, default false. Does not allow activation on outside release.

Returns bool

true when pressed appearance is retained outside during holding.

IsPressedbool
# IsPressed
C#
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.

Returns bool

Toggle state, or a current ordinary-button press attempt.

IsShortcutFeedbackbool
# IsShortcutFeedback
C#
public bool IsShortcutFeedback();

Show brief visual feedback for Shortcut activation, default true. false does not disable the shortcut itself.

Returns bool

true when visual shortcut feedback is enabled.

IsShortcutInTooltipEnabledbool
# IsShortcutInTooltipEnabled
C#
public bool IsShortcutInTooltipEnabled();

Include Shortcut information in the standard tooltip, default true. Does not enable/disable shortcut handling; custom tooltips can be supplied separately.

Returns bool

true when shortcut information is enabled in tooltips.

IsToggleModebool
# IsToggleMode
C#
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.

Returns bool

true for persistent toggle-state mode.

Pressvoid
# Press
C#
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
# SetActionMode
C#
public void SetActionMode(BaseButton.ActionModeEnum mode);

Input activation timing: Press on press, Release on release, default Release. Programmatic Press and Shortcut activation are immediate.

Parameters
NameTypeDefault
modeBaseButton.ActionModeEnum—
mode

Input activation timing: Press on press, Release on release, default Release. Programmatic Press and Shortcut activation are immediate.

SetButtonGroupvoid
# SetButtonGroup
C#
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.

Parameters
NameTypeDefault
buttonGroupButtonGroup—
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.

SetButtonMaskvoid
# SetButtonMask
C#
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.

Parameters
NameTypeDefault
maskMouseButtonMask—
mask

Accepted mouse-button bitmask, default Left. Combine MouseButtonMask.Left | MouseButtonMask.Right if needed. Does not disable ui_accept or Shortcut.

SetDisabledvoid
# SetDisabled
C#
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.

Parameters
NameTypeDefault
disabledbool—
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.

SetKeepPressedOutsidevoid
# SetKeepPressedOutside
C#
public void SetKeepPressedOutside(bool enabled);

Retains pressed appearance when the pointer leaves during holding, default false. Does not allow activation on outside release.

Parameters
NameTypeDefault
enabledbool—
enabled

Retains pressed appearance when the pointer leaves during holding, default false. Does not allow activation on outside release.

SetPressedvoid
# SetPressed
C#
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.

Parameters
NameTypeDefault
pressedbool—
pressed

Requested toggle state; ignored without ToggleMode.

SetPressedNoSignalvoid
# SetPressedNoSignal
C#
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.

Parameters
NameTypeDefault
pressedbool—
pressed

Requested toggle state; ignored without ToggleMode.

SetShortcutvoid
# SetShortcut
C#
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.

Parameters
NameTypeDefault
shortcutShortcut—
shortcut

Shared Shortcut resource, or null. Assignment enables shortcut processing; a matching non-echo event invokes Press on a visible button. Disabled blocks activation.

SetShortcutFeedbackvoid
# SetShortcutFeedback
C#
public void SetShortcutFeedback(bool enabled);

Show brief visual feedback for Shortcut activation, default true. false does not disable the shortcut itself.

Parameters
NameTypeDefault
enabledbool—
enabled

Show brief visual feedback for Shortcut activation, default true. false does not disable the shortcut itself.

SetShortcutInTooltipvoid
# SetShortcutInTooltip
C#
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.

Parameters
NameTypeDefault
enabledbool—
enabled

Include Shortcut information in the standard tooltip, default true. Does not enable/disable shortcut handling; custom tooltips can be supplied separately.

SetToggleModevoid
# SetToggleMode
C#
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.

Parameters
NameTypeDefault
enabledbool—
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.

_Pressedvoid
# _Pressed
C#
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
# _Toggled
C#
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.

Parameters
NameTypeDefault
toggledOnbool—
toggledOn

Notified toggle state; true can repeat without a transition in a mandatory-selection group.

Signals and events4

ButtonDownEvent
# ButtonDown
C#
public event Action ButtonDown;

Beginning of accepted holding through input. Not final activation or programmatic Press. Pressed timing separately depends on ActionMode.

ButtonUpEvent
# ButtonUp
C#
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
# Pressed
C#
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
# Toggled
C#
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.

Handler parameters
NameTypeDefault
toggledOnbool—
toggledOn

Notified toggle state; true can repeat without a transition in a mandatory-selection group.

BaseButton.ActionModeEnum

ValueDescription
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

ValueDescription
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 typeDescription
click_margin
int

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_sound
AudioStream

Played when this BaseButton receives keyboard or gamepad-induced focus. Mouse or touch-induced focus does not play a focus sound.

hover_sound
AudioStream

Played when the button is hovered with the mouse.

pressed_disabled_sound
AudioStream

Played when the button is pressed with any input method, but has BaseButton.Disabled set to true.

pressed_sound
AudioStream

Played when the button is pressed with any input method.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.