Index · Object → Node → Viewport → Window → AcceptDialog

AcceptDialog

A base dialog used for user notification.

Inherited by (1): ConfirmationDialog
Class Description

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

Note: AcceptDialog is invisible by default. To make it visible, call one of the popup_* methods from Window on the node, such as Window.popup_centered_clamped().

Properties

var dialog_autowrap: bool = false

Sets autowrapping for the text in the dialog.

var dialog_close_on_escape: bool = true

If true, the dialog will be hidden when the ui_close_dialog action is pressed (by default, this action is bound to Escape, or Cmd + W on macOS).

var dialog_hide_on_ok: bool = true

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 confirmed 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.

var dialog_text: String = ""

The text displayed by the dialog.

var exclusive: bool = true
var keep_title_visible: bool = true
var maximize_disabled: bool = true
var minimize_disabled: bool = true
var ok_button_text: String = ""

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

var title: String = "Alert!"
var transient: bool = true
var visible: bool = false
var wrap_controls: bool = true
Inherited from Window (41)
var always_on_top: bool = false
var borderless: bool = false
var content_scale_size: Vector2i = Vector2i(0, 0)
var exclusive: bool = false
var extend_to_title: bool = false
var force_native: bool = false
var max_size: Vector2i = Vector2i(0, 0)
var maximize_disabled: bool = false
var min_size: Vector2i = Vector2i(0, 0)
var minimize_disabled: bool = false
var mode: Window.Mode = 0
var mouse_passthrough: bool = false
var mouse_passthrough_polygon: PackedVector2Array = PackedVector2Array()
var nonclient_area: Rect2i = Rect2i(0, 0, 0, 0)
var popup_window: bool = false
var popup_wm_hint: bool = false
var position: Vector2i = Vector2i(0, 0)
var sharp_corners: bool = false
var size: Vector2i = Vector2i(100, 100)
var title: String = ""
var transient: bool = false
var transparent: bool = false
var unfocusable: bool = false
var unresizable: bool = false
var visible: bool = true
var wrap_controls: bool = false
Inherited from Viewport (51)
var canvas_cull_mask: int = 4294967295
var disable_3d: bool = false
var fsr_sharpness: float = 0.2
var gui_disable_input: bool = false
var oversampling: bool = true
var own_world_3d: bool = false
var transparent_bg: bool = false
var use_debanding: bool = false
var use_hdr_2d: bool = false
var use_taa: bool = false
var use_xr: bool = false
Inherited from Node (14)
var owner: Node

Methods

func add_button(text: String, right: bool = false, action: String = "") -> Button

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 custom_action signal with the specified action string.

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

You can use remove_button() method to remove a button created with this method from the dialog.

func add_cancel_button(name: String) -> Button

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

You can use remove_button() method to remove a button created with this method from the dialog.

func get_label() -> Label

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 get_ok_button() -> Button

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 register_text_enter(line_edit: LineEdit) -> void

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

func remove_button(button: Button) -> void

Removes the button from the dialog. Does NOT free the button. The button must be a Button added with add_button() or add_cancel_button() method. After removal, pressing the button will no longer emit this dialog's custom_action or canceled signals.

Inherited from Window (78)
func add_theme_color_override(name: StringName, color: Color) -> void
func add_theme_constant_override(name: StringName, constant: int) -> void
func add_theme_font_override(name: StringName, font: Font) -> void
func add_theme_font_size_override(name: StringName, font_size: int) -> void
func add_theme_icon_override(name: StringName, texture: Texture2D) -> void
func add_theme_stylebox_override(name: StringName, stylebox: StyleBox) -> void
func can_draw() -> bool
func child_controls_changed() -> void
func get_flag(flag: Window.Flags) -> bool
func get_theme_color(name: StringName, theme_type: StringName = &"") -> Color
func get_theme_constant(name: StringName, theme_type: StringName = &"") -> int
func get_theme_font(name: StringName, theme_type: StringName = &"") -> Font
func get_theme_font_size(name: StringName, theme_type: StringName = &"") -> int
func get_theme_icon(name: StringName, theme_type: StringName = &"") -> Texture2D
func get_theme_stylebox(name: StringName, theme_type: StringName = &"") -> StyleBox
func get_window_id() -> int
func grab_focus() -> void
func has_focus() -> bool
func has_theme_color(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_constant(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_font(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_font_size(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_icon(name: StringName, theme_type: StringName = &"") -> bool
func has_theme_stylebox(name: StringName, theme_type: StringName = &"") -> bool
func hide() -> void
func is_embedded() -> bool
func move_to_center() -> void
func move_to_foreground() -> void
func popup(rect: Rect2i = Rect2i(0, 0, 0, 0)) -> void
func popup_centered(minsize: Vector2i = Vector2i(0, 0)) -> void
func popup_centered_clamped(minsize: Vector2i = Vector2i(0, 0), fallback_ratio: float = 0.75) -> void
func popup_centered_ratio(ratio: float = 0.8) -> void
func popup_exclusive(from_node: Node, rect: Rect2i = Rect2i(0, 0, 0, 0)) -> void
func popup_exclusive_centered(from_node: Node, minsize: Vector2i = Vector2i(0, 0)) -> void
func popup_exclusive_centered_clamped(from_node: Node, minsize: Vector2i = Vector2i(0, 0), fallback_ratio: float = 0.75) -> void
func popup_exclusive_centered_ratio(from_node: Node, ratio: float = 0.8) -> void
func popup_exclusive_on_parent(from_node: Node, parent_rect: Rect2i) -> void
func popup_on_parent(parent_rect: Rect2i) -> void
func request_attention() -> void
func reset_size() -> void
func set_flag(flag: Window.Flags, enabled: bool) -> void
func set_ime_active(active: bool) -> void
func set_ime_position(position: Vector2i) -> void
func set_taskbar_progress_value(value: float) -> void
func set_unparent_when_invisible(unparent: bool) -> void
func set_use_font_oversampling(enable: bool) -> void
func show() -> void
func start_drag() -> void
Inherited from Viewport (38)
func get_embedded_subwindows() -> Window[]
func gui_cancel_drag() -> void
func gui_release_focus() -> void
func gui_set_drag_description(description: String) -> void
func notify_mouse_entered() -> void
func notify_mouse_exited() -> void
func push_input(event: InputEvent, in_local_coords: bool = false) -> void
func push_text_input(text: String) -> void
func push_unhandled_input(event: InputEvent, in_local_coords: bool = false) -> void
func set_canvas_cull_mask_bit(layer: int, enable: bool) -> void
func set_input_as_handled() -> void
func warp_mouse(position: Vector2) -> void
Inherited from Node (106)
func _enter_tree() -> void
func _exit_tree() -> void
func _input(event: InputEvent) -> void
func _physics_process(delta: float) -> void
func _process(delta: float) -> void
func _ready() -> void
func _shortcut_input(event: InputEvent) -> void
func _unhandled_input(event: InputEvent) -> void
func _unhandled_key_input(event: InputEvent) -> void
func add_child(node: Node, force_readable_name: bool = false, internal: Node.InternalMode = 0) -> void
func add_sibling(sibling: Node, force_readable_name: bool = false) -> void
func add_to_group(group: StringName, persistent: bool = false) -> void
func atr(message: String, context: StringName = "") -> String
func atr_n(message: String, plural_message: StringName, n: int, context: StringName = "") -> String
func can_process() -> bool
func duplicate(flags: int = 15) -> Node
func find_child(pattern: String, recursive: bool = true, owned: bool = true) -> Node
func find_children(pattern: String, type: String = "", recursive: bool = true, owned: bool = true) -> Node[]
func find_parent(pattern: String) -> Node
func get_child(idx: int, include_internal: bool = false) -> Node
func get_child_count(include_internal: bool = false) -> int
func get_children(include_internal: bool = false) -> Node[]
func get_groups() -> StringName[]
func get_index(include_internal: bool = false) -> int
func get_node(path: NodePath) -> Node
func get_orphan_node_ids() -> int[]
func get_parent() -> Node
func get_path() -> NodePath
func get_path_to(node: Node, use_unique_path: bool = false) -> NodePath
func get_window() -> Window
func has_node(path: NodePath) -> bool
func is_ancestor_of(node: Node) -> bool
func is_greater_than(node: Node) -> bool
func is_in_group(group: StringName) -> bool
func move_child(child_node: Node, to_index: int) -> void
func notify_deferred_thread_group(what: int) -> void
func notify_thread_safe(what: int) -> void
func print_orphan_nodes() -> void
func print_tree() -> void
func print_tree_pretty() -> void
func propagate_call(method: StringName, args: Array = [], parent_first: bool = false) -> void
func propagate_notification(what: int) -> void
func queue_free() -> void
func remove_child(node: Node) -> void
func remove_from_group(group: StringName) -> void
func reparent(new_parent: Node, keep_global_transform: bool = true) -> void
func replace_by(node: Node, keep_groups: bool = false) -> void
func request_ready() -> void
func rpc(method: StringName) -> Error
func rpc_config(method: StringName, config: Variant) -> void
func rpc_id(peer_id: int, method: StringName) -> Error
func set_deferred_thread_group(property: StringName, value: Variant) -> void
func set_display_folded(fold: bool) -> void
func set_editable_instance(node: Node, is_editable: bool) -> void
func set_multiplayer_authority(id: int, recursive: bool = true) -> void
func set_physics_process(enable: bool) -> void
func set_physics_process_internal(enable: bool) -> void
func set_process(enable: bool) -> void
func set_process_input(enable: bool) -> void
func set_process_internal(enable: bool) -> void
func set_process_shortcut_input(enable: bool) -> void
func set_process_unhandled_input(enable: bool) -> void
func set_scene_instance_load_placeholder(load_placeholder: bool) -> void
func set_thread_safe(property: StringName, value: Variant) -> void
Inherited from Object (62)
func _get(property: StringName) -> Variant
func _get_property_list() -> Dictionary[]
func _init() -> void
func _iter_get(iter: Variant) -> Variant
func _iter_init(iter: Array) -> bool
func _iter_next(iter: Array) -> bool
func _notification(what: int) -> void
func _set(property: StringName, value: Variant) -> bool
func _to_string() -> String
func _validate_property(property: Dictionary) -> void
func add_user_signal(signal: String, arguments: Array = []) -> void
func call(method: StringName) -> Variant
func callv(method: StringName, arg_array: Array) -> Variant
func cancel_free() -> void
func connect(signal: StringName, callable: Callable, flags: int = 0) -> Error
func disconnect(signal: StringName, callable: Callable) -> void
func emit_signal(signal: StringName) -> Error
func free() -> void
func get(property: StringName) -> Variant
func get_class() -> String
func get_incoming_connections() -> Dictionary[]
func get_indexed(property_path: NodePath) -> Variant
func get_meta(name: StringName, default: Variant = null) -> Variant
func get_meta_list() -> StringName[]
func get_method_list() -> Dictionary[]
func get_property_list() -> Dictionary[]
func get_signal_connection_list(signal: StringName) -> Dictionary[]
func get_signal_list() -> Dictionary[]
func has_meta(name: StringName) -> bool
func has_method(method: StringName) -> bool
func has_signal(signal: StringName) -> bool
func is_class(class: StringName) -> bool
func is_connected(signal: StringName, callable: Callable) -> bool
func notification(what: int, reversed: bool = false) -> void
func remove_meta(name: StringName) -> void
func remove_user_signal(signal: StringName) -> void
func set(property: StringName, value: Variant) -> void
func set_block_signals(enable: bool) -> void
func set_deferred(property: StringName, value: Variant) -> void
func set_indexed(property_path: NodePath, value: Variant) -> void
func set_message_translation(enable: bool) -> void
func set_meta(name: StringName, value: Variant) -> void
func set_script(script: Variant) -> void
func set_translation_domain(domain: StringName) -> void
func to_string() -> String
func tr(message: StringName, context: StringName = &"") -> String
func tr_n(message: StringName, plural_message: StringName, n: int, context: StringName = &"") -> String

Signals

signal canceled()

Emitted when the dialog is closed or the button created with add_cancel_button() is pressed.

signal confirmed()

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

signal custom_action(action: StringName)

Emitted when a custom button with an action is pressed. See add_button().

Inherited from Window (16)
signal dpi_changed()
signal focus_entered()
signal focus_exited()
signal mouse_entered()
signal mouse_exited()
signal output_max_linear_value_changed(output_max_linear_value: float)
signal theme_changed()
signal title_changed()
signal window_input(event: InputEvent)
Inherited from Viewport (2)
signal size_changed()
Inherited from Node (11)
signal child_entered_tree(node: Node)
signal child_exiting_tree(node: Node)
signal ready()
signal renamed()
signal replacing_by(node: Node)
signal tree_entered()
signal tree_exited()
signal tree_exiting()
Inherited from Object (2)