Skip to content

BaseButton

Eduard Gushchin edited this page Jun 24, 2026 · 3 revisions

Home | API by Category | Complete API Index | API Compatibility

Field Value
Full name Electron2D.BaseButton
Namespace Electron2D
Kind class
Category UI and Text

Overview

Provides shared input, focus and signal behavior for button controls.

Syntax

public class Electron2D.BaseButton : Electron2D.Control

Godot 4.7 C# profile compatibility

Profile: Electron2D 0.1.0 2D
Status: Supported / Parity verified
Out of profile: no
Godot reference: BaseButton

Shared button input, focus, disabled state, toggle state, action mode and button_down/button_up/pressed/toggled signals.

Remarks

BaseButton handles pointer, touch, keyboard and gamepad activation. Derived controls provide visual content such as text, check marks or textures.

The following signals are available: button_down, button_up, pressed and toggled.

Thread Safety

This type is not synchronized. Create and mutate buttons on the main scene thread.

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Button
  • Electron2D.CheckBox
  • Electron2D.TextureButton

Members

Member Kind Summary
ActionMode Property Gets or sets when this button activates.
ButtonPressed Property Gets or sets whether this button is currently pressed as a toggle.
Disabled Property Gets or sets whether this button is disabled.
ToggleMode Property Gets or sets whether this button toggles its pressed state.
Electron2D.BaseButton() Constructor Initializes a new instance of the Electron2D.BaseButton class.
_GuiInput(Electron2D.InputEvent) Method Handles GUI input routed to this button.

Member Details

ActionMode

Kind: Property

public Electron2D.BaseButton.ActionModeEnum ActionMode { get; set; }

Summary

Gets or sets when this button activates.

Remarks

Electron2D.BaseButton.ActionModeEnum.ButtonRelease is the default. It lets users cancel pointer/touch activation by releasing outside the control.

Value

A value that controls whether activation happens on press or release.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.BaseButton.ActionModeEnum

ButtonPressed

Kind: Property

public System.Boolean ButtonPressed { get; set; }

Summary

Gets or sets whether this button is currently pressed as a toggle.

Remarks

User activation changes this property only when Electron2D.BaseButton.ToggleMode is enabled. Assigning this property directly updates state without emitting pressed or toggled.

Value

true when the button is in the pressed state; otherwise, false.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.BaseButton.ToggleMode

Disabled

Kind: Property

public System.Boolean Disabled { get; set; }

Summary

Gets or sets whether this button is disabled.

Remarks

Disabled buttons ignore pointer, touch, keyboard and gamepad input and cannot receive focus.

Value

true when input and focus are disabled; otherwise, false.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Control.FocusMode

ToggleMode

Kind: Property

public System.Boolean ToggleMode { get; set; }

Summary

Gets or sets whether this button toggles its pressed state.

Remarks

Toggle buttons emit toggled with the new Electron2D.BaseButton.ButtonPressed value when activated.

Value

true for toggle behavior; otherwise, false.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.BaseButton.ButtonPressed

Electron2D.BaseButton()

Kind: Constructor

public Electron2D.BaseButton()

Summary

Initializes a new instance of the Electron2D.BaseButton class.

Remarks

The constructor registers the standard button signals and enables keyboard/gamepad focus by default.

Thread Safety

This constructor is not synchronized. Call it from the main scene thread.

Since

This constructor is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.BaseButton

_GuiInput(Electron2D.InputEvent)

Kind: Method

public System.Void _GuiInput(Electron2D.InputEvent)(Electron2D.InputEvent inputEvent)

Summary

Handles GUI input routed to this button.

Remarks

This method consumes supported activation input through Electron2D.Control.AcceptEvent after updating button state.

Parameters

  • inputEvent: The input event delivered by the viewport.

Thread Safety

This callback is invoked on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Control._GuiInput(Electron2D.InputEvent)

Clone this wiki locally