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 ¶
- type Advanced
- type Any
- type Expanded
- type Extension
- type ID
- type Instance
- func (self Instance) AddButton(text string) Button.Instance
- func (self Instance) AddCancelButton(name string) Button.Instance
- func (self Instance) AsAcceptDialog() Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsViewport() Viewport.Instance
- func (self Instance) AsWindow() Window.Instance
- func (self Instance) DialogAutowrap() bool
- func (self Instance) DialogCloseOnEscape() bool
- func (self Instance) DialogHideOnOk() bool
- func (self Instance) DialogText() string
- func (self Instance) GetLabel() Label.Instance
- func (self Instance) GetOkButton() Button.Instance
- func (self Instance) ID() ID
- func (self Instance) MoreArgs() MoreArgs
- func (self Instance) OkButtonText() string
- func (self Instance) OnCanceled(cb func(), flags ...Signal.Flags)
- func (self Instance) OnConfirmed(cb func(), flags ...Signal.Flags)
- func (self Instance) OnCustomAction(cb func(action string), flags ...Signal.Flags)
- func (self Instance) RegisterTextEnter(line_edit LineEdit.Instance)
- func (self Instance) RemoveButton(button Button.Instance)
- func (self Instance) SetDialogAutowrap(value bool)
- func (self Instance) SetDialogCloseOnEscape(value bool)
- func (self Instance) SetDialogHideOnOk(value bool)
- func (self Instance) SetDialogText(value string)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetOkButtonText(value string)
- func (self Instance) Virtual(name string) reflect.Value
- type MoreArgs
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 Extension ¶
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 (*Extension[T]) AsViewport ¶
type 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.
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 (Instance) AddButton ¶
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 ¶
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 (Instance) AsViewport ¶
func (Instance) DialogAutowrap ¶
Sets autowrapping for the text in the dialog.
func (Instance) DialogCloseOnEscape ¶
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 ¶
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 ¶
The text displayed by the dialog.
func (Instance) GetLabel ¶
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 ¶
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) MoreArgs ¶
MoreArgs enables certain functions to be called with additional 'optional' arguments.
func (Instance) OkButtonText ¶
The text displayed by the OK button (see GetOkButton). If empty, a default text will be used.
func (Instance) OnCanceled ¶
Emitted when the dialog is closed or the button created with AddCancelButton is pressed.
func (Instance) OnConfirmed ¶
Emitted when the dialog is accepted, i.e. the OK button is pressed.
func (Instance) OnCustomAction ¶
Emitted when a custom button with an action is pressed. See AddButton.
func (Instance) RegisterTextEnter ¶
Registers a LineEdit in the dialog. When the enter key is pressed, the dialog will be accepted.
func (Instance) RemoveButton ¶
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 ¶
SetDialogAutowrap sets the property returned by [HasAutowrap].
func (Instance) SetDialogCloseOnEscape ¶
SetDialogCloseOnEscape sets the property returned by [GetCloseOnEscape].
func (Instance) SetDialogHideOnOk ¶
SetDialogHideOnOk sets the property returned by [GetHideOnOk].
func (Instance) SetDialogText ¶
SetDialogText sets the property returned by [GetText].
func (Instance) SetOkButtonText ¶
SetOkButtonText sets the property returned by [GetOkButtonText].
type MoreArgs ¶
type MoreArgs [1]gdclass.AcceptDialog
MoreArgs is a container for Instance functions with additional 'optional' arguments.
func (MoreArgs) AddButton ¶
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.