AcceptDialog

package
v0.0.0-...-20ed0ac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2025 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

The default use of AcceptDialog is to allow it to only be accepted or closed, with the same result. However, the OnConfirmed and OnCanceled signals allow to make the two actions different, and the AddButton method allows to add custom buttons and actions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsAcceptDialog() Instance
}

type Expanded

type Expanded = MoreArgs

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsAcceptDialog

func (self *Extension[T]) AsAcceptDialog() Instance

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsViewport

func (self *Extension[T]) AsViewport() Viewport.Instance

func (*Extension[T]) AsWindow

func (self *Extension[T]) AsWindow() Window.Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.AcceptDialog

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AddButton

func (self Instance) AddButton(text string) Button.Instance

Adds a button with label 'text' and a custom 'action' to the dialog and returns the created button.

If 'action' is not empty, pressing the button will emit the OnCustomAction signal with the specified action string.

If true, 'right' will place the button to the right of any sibling buttons.

You can use RemoveButton method to remove a button created with this method from the dialog.

func (Instance) AddCancelButton

func (self Instance) AddCancelButton(name string) Button.Instance

Adds a button with label 'name' and a cancel action to the dialog and returns the created button.

You can use RemoveButton method to remove a button created with this method from the dialog.

func (Instance) AsAcceptDialog

func (self Instance) AsAcceptDialog() Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsViewport

func (self Instance) AsViewport() Viewport.Instance

func (Instance) AsWindow

func (self Instance) AsWindow() Window.Instance

func (Instance) DialogAutowrap

func (self Instance) DialogAutowrap() bool

Sets autowrapping for the text in the dialog.

func (Instance) DialogCloseOnEscape

func (self Instance) DialogCloseOnEscape() bool

If true, the dialog will be hidden when the ui_cancel action is pressed (by default, this action is bound to [KeyEscape]).

func (Instance) DialogHideOnOk

func (self Instance) DialogHideOnOk() bool

If true, the dialog is hidden when the OK button is pressed. You can set it to false if you want to do e.g. input validation when receiving the OnConfirmed signal, and handle hiding the dialog in your own logic.

Note: Some nodes derived from this class can have a different default value, and potentially their own built-in logic overriding this setting. For example FileDialog defaults to false, and has its own input validation code that is called when you press OK, which eventually hides the dialog if the input is valid. As such, this property can't be used in FileDialog to disable hiding the dialog when pressing OK.

func (Instance) DialogText

func (self Instance) DialogText() string

The text displayed by the dialog.

func (Instance) GetLabel

func (self Instance) GetLabel() Label.Instance

Returns the label used for built-in text.

Warning: This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their CanvasItem.Visible property.

func (Instance) GetOkButton

func (self Instance) GetOkButton() Button.Instance

Returns the OK Button instance.

Warning: This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their CanvasItem.Visible property.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) MoreArgs

func (self Instance) MoreArgs() MoreArgs

MoreArgs enables certain functions to be called with additional 'optional' arguments.

func (Instance) OkButtonText

func (self Instance) OkButtonText() string

The text displayed by the OK button (see GetOkButton). If empty, a default text will be used.

func (Instance) OnCanceled

func (self Instance) OnCanceled(cb func(), flags ...Signal.Flags)

Emitted when the dialog is closed or the button created with AddCancelButton is pressed.

func (Instance) OnConfirmed

func (self Instance) OnConfirmed(cb func(), flags ...Signal.Flags)

Emitted when the dialog is accepted, i.e. the OK button is pressed.

func (Instance) OnCustomAction

func (self Instance) OnCustomAction(cb func(action string), flags ...Signal.Flags)

Emitted when a custom button with an action is pressed. See AddButton.

func (Instance) RegisterTextEnter

func (self Instance) RegisterTextEnter(line_edit LineEdit.Instance)

Registers a LineEdit in the dialog. When the enter key is pressed, the dialog will be accepted.

func (Instance) RemoveButton

func (self Instance) RemoveButton(button Button.Instance)

Removes the 'button' from the dialog. Does NOT free the 'button'. The 'button' must be a Button added with AddButton or AddCancelButton method. After removal, pressing the 'button' will no longer emit this dialog's OnCustomAction or OnCanceled signals.

func (Instance) SetDialogAutowrap

func (self Instance) SetDialogAutowrap(value bool)

SetDialogAutowrap sets the property returned by [HasAutowrap].

func (Instance) SetDialogCloseOnEscape

func (self Instance) SetDialogCloseOnEscape(value bool)

SetDialogCloseOnEscape sets the property returned by [GetCloseOnEscape].

func (Instance) SetDialogHideOnOk

func (self Instance) SetDialogHideOnOk(value bool)

SetDialogHideOnOk sets the property returned by [GetHideOnOk].

func (Instance) SetDialogText

func (self Instance) SetDialogText(value string)

SetDialogText sets the property returned by [GetText].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetOkButtonText

func (self Instance) SetOkButtonText(value string)

SetOkButtonText sets the property returned by [GetOkButtonText].

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type MoreArgs

type MoreArgs [1]gdclass.AcceptDialog

MoreArgs is a container for Instance functions with additional 'optional' arguments.

func (MoreArgs) AddButton

func (self MoreArgs) AddButton(text string, right bool, action string) Button.Instance

Adds a button with label 'text' and a custom 'action' to the dialog and returns the created button.

If 'action' is not empty, pressing the button will emit the OnCustomAction signal with the specified action string.

If true, 'right' will place the button to the right of any sibling buttons.

You can use RemoveButton method to remove a button created with this method from the dialog.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL