PendingDialog
Model representing a pending dialog box with user interaction.
PendingDialog manages the state and configuration of modal dialogs, including alert dialogs, confirmation dialogs, and prompt dialogs. It tracks user interaction results and provides callback mechanisms for handling user responses.
Features:
- Multiple choice support with custom button labels
- Optional text input with prompt functionality
- Cancelable dialogs with escape handling
- Configurable dimensions and styling
- Async operation support
- Callback-based result handling
- Unique key identification for dialog management
Example usage:
var dialog = new PendingDialog(
"confirm_delete",
"Confirm Delete",
"Are you sure you want to delete this item?",
false, null, null,
["Cancel", "Delete"],
true, -1, -1, true,
(index, text) -> {
if (index == 1) {
// User clicked Delete
}
}
);
Instance Members
Index of the chosen button (-1 if none chosen yet)
Whether the dialog was canceled (typically via Escape key)
Pointer to the prompt text input value (for prompt dialogs)
Placeholder text for the prompt input field
Unique identifier for this dialog instance
Title text displayed in the dialog header
Main message text displayed in the dialog body
Array of button labels for user choices
Whether the dialog can be canceled (e.g., with Escape key)
Fixed width of the dialog (-1 for auto-sizing)
Fixed height of the dialog (-1 for auto-sizing)
Whether the dialog operates asynchronously
Callback function called when user makes a choice
Name | Type |
---|---|
index |
Int |
text |
String |
Cleans up dialog resources when destroyed.
Clears references to strings, arrays, and callback functions to prevent memory leaks and ensure proper garbage collection.
new(?key: String, title: String, message: String, ?prompt: Bool = false, ?promptPointer: StringPointer, ?promptPlaceholder: String, choices: Array<String>, ?cancelable: Bool = false, ?width: Float = -1, ?height: Float = -1, async: Bool, callback: Function): Void
Creates a new PendingDialog instance.
Configures all dialog properties and sets up prompt functionality if needed. If prompt is enabled but no promptPointer is provided, creates an internal string pointer for managing the prompt value.
Name | Type | Default | Description |
---|---|---|---|
key |
String | (optional) | Optional unique identifier for the dialog |
title |
String | Title text for the dialog header | |
message |
String | Main message text for the dialog body | |
prompt |
Bool | false |
Whether to include a text input prompt |
promptPointer |
StringPointer | (optional) | Optional string pointer for prompt value binding |
promptPlaceholder |
String | (optional) | Placeholder text for the prompt input |
choices |
Array<String> | Array of button labels for user choices | |
cancelable |
Bool | false |
Whether the dialog can be canceled |
width |
Float | -1 |
Fixed width (-1 for auto-sizing) |
height |
Float | -1 |
Fixed height (-1 for auto-sizing) |
async |
Bool | Whether the dialog operates asynchronously | |
callback |
Function | Function called when user makes a choice |
Private Members
Metadata
Name | Parameters |
---|---|
:build |
tracker.macros.EventsMacro.build() |
:autoBuild |
tracker.macros.EventsMacro.build() |
:build |
ceramic.macros.EntityMacro.buildForCompletion() |
:autoBuild |
ceramic.macros.EntityMacro.buildForCompletion() |
:build |
tracker.macros.ObservableMacro.build() |
:autoBuild |
tracker.macros.ObservableMacro.build() |
:build |
tracker.macros.SerializableMacro.build() |
:autoBuild |
tracker.macros.SerializableMacro.build() |