Canvas Toolkit
← Class index

CInputDialog

Dialogs · extends CDialog

Dialog for requesting a text or integer value from the user.

import { CInputDialog } from "canvas-toolkit-lib";

Declared members

static readonly DefaultWidth = 360;
static readonly DefaultHeight = 120;
static readonly Margin = 12;
static readonly Spacing = 8;
readonly textValueChanged: CSignal<[string]>;

Emitted when the text value changes.

readonly textValueSelected: CSignal<[string]>;

Emitted when a text value is accepted.

readonly intValueChanged: CSignal<[number]>;

Emitted when the integer value changes.

readonly intValueSelected: CSignal<[number]>;

Emitted when an integer value is accepted.

constructor(parent?: CWidget | null);

Creates an input dialog. @param parent Optional parent widget.

inputMode(): CInputDialogInputMode;

Returns the active input mode. @returns The current input mode.

setInputMode(mode: CInputDialogInputMode): void;

Sets the active input mode. @param mode Input mode to use.

labelText(): string;

Returns the prompt label text. @returns The current label text.

setLabelText(text: string): void;

Sets the prompt label text. @param text New label text.

textValue(): string;

Returns the current text value. @returns The current text value.

setTextValue(text: string): void;

Sets the current text value. @param text New text value.

intValue(): number;

Returns the current integer value. @returns The current integer value.

setIntValue(value: number): void;

Sets the current integer value. @param value New integer value.

intMinimum(): number;

Returns the minimum allowed integer value. @returns Minimum integer value.

setIntMinimum(minimum: number): void;

Sets the minimum allowed integer value. @param minimum Minimum value.

intMaximum(): number;

Returns the maximum allowed integer value. @returns Maximum integer value.

setIntMaximum(maximum: number): void;

Sets the maximum allowed integer value. @param maximum Maximum value.

setIntRange(minimum: number, maximum: number): void;

Sets the allowed integer range. @param minimum Minimum value. @param maximum Maximum value.

intStep(): number;

Returns the integer step size. @returns Current step size.

setIntStep(step: number): void;

Sets the integer step size. @param step Step size.

static getText(parent: CWidget | null, title: string, label: string, value?: string): Promise<string | null>;

Shows a modal dialog and requests a text value. @param parent Optional parent widget. @param title Dialog title. @param label Prompt label. @param value Initial text value. @returns A promise resolving to the selected text, or `null` if rejected.

static getInt(parent: CWidget | null, title: string, label: string, value?: number, minimum?: number, maximum?: number, step?: number): Promise<number | null>;

Shows a modal dialog and requests an integer value. @param parent Optional parent widget. @param title Dialog title. @param label Prompt label. @param value Initial value. @param minimum Minimum allowed value. @param maximum Maximum allowed value. @param step Step size. @returns A promise resolving to the selected integer, or `null` if rejected.