User Tools

Site Tools


en:code:windows:inputdialog

InputDialog

This object represents a window asking the user to enter data.

Functions

InputDialog

Constructor function.

Syntax

var myObject = new InputDialog();
var myObject = new InputDialog(parameters);

Arguments

  1. parameters - (object) window parameters
    • title - (string) the window's title
    • position - (Point) the window's position
    • opacity - (float) the window's opacity
    • enabled - (boolean) the window's enabled status
    • visible - (boolean) the window's visible status
    • labelText - (string) the label text
    • okButtonText - (string) the text of the ok button
    • cancelButtonText - (string) the text of the cancel button
    • textEchoMode - (TextEchoMode) the text echo mode
    • floatDecimals - (integer) the number of decimals
    • integerStep - (integer) the integer step
    • minimum - (mixed) the minimum value
    • maximum - (mixed) the maximum value
    • range - (object) the range
      • minimum - (mixed) the minimum value
      • maximum - (mixed) the maximum value
    • inputType - (InputType) the input type
    • value - (mixed) the default value
    • items - (array) the items (used when asking an item from a list)
    • itemsEditable - (boolean) are the items from the list editable
    • onClosed - (OnClosed) event called when the window is closed
    • onValueChanged - (OnValueChanged) event called when the value changes

Exceptions

  • (ParameterTypeError) incorrect parameter type
  • (ParameterCountError) incorrect parameter count

Example

var myObject = new InputDialog();
var myObject = new InputDialog({
	title: "Enter text:",
	inputType: InputDialog.Text
});

Methods

setTitle

Sets the window's title.

Syntax

myObject.setTitle(title);

Arguments

  1. title - (string) the window's title

Returns

  • (InputDialog) this InputDialog

setPosition

Sets the window's position.

Syntax

myObject.setPosition(point);

Arguments

  1. point - (Point) the window's position

Returns

  • (InputDialog) this InputDialog

setOpacity

Sets the window's opacity.

Syntax

myObject.setOpacity(opacity);

Arguments

  1. opacity - (float) the window's opacity

Returns

  • (InputDialog) this InputDialog

setEnabled

Sets the window's enabled status.

Syntax

myObject.setEnabled(enabled);

Arguments

  1. enabled - (boolean) the window's enabled status

Returns

  • (InputDialog) this InputDialog

setVisible

Sets the window's visible status.

Syntax

myObject.setVisible(visible);

Arguments

  1. visible - (boolean) the window's visible status

Returns

  • (InputDialog) this InputDialog

close

Closes the window.

Syntax

myObject.close();

Returns

  • (InputDialog) this InputDialog

title

Returns the window's title.

Syntax

myObject.title();

Returns

  • (string) the window's title

position

Returns the window's position.

Syntax

myObject.position();

Returns

  • (Point) the window's position

opacity

Returns the window's opacity.

Syntax

myObject.opacity();

Returns

  • (float) the window's opacity

enabled

Returns the window's enabled status.

Syntax

myObject.enabled();

Returns

  • (boolean) the window's enabled status

visible

Returns the window's visible status.

Syntax

myObject.visible();

Returns

  • (boolean) the window's visible status

setLabelText

Sets the label text.

Syntax

myObject.setLabelText(text);

Arguments

  1. text - (string) the label text

Returns

  • (InputDialog) this InputDialog

setOkButtonText

Sets the ok button text.

Syntax

myObject.setLabelText(text);

Arguments

  1. text - (string) the ok button's label

Returns

  • (InputDialog) this InputDialog

setCancelButtonText

Sets the cancel button text.

Syntax

myObject.setCancelButtonText(text);

Arguments

  1. text - (string) the cancel button's label

Returns

  • (InputDialog) this InputDialog

setTextEchoMode

Sets the text echo mode.

Syntax

myObject.setTextEchoMode(textEchoMode);

Arguments

  1. textEchoMode - (TextEchoMode) the text echo mode

Returns

  • (InputDialog) this InputDialog

setFloatDecimals

Sets the number of decimals of floating values.

Syntax

myObject.setFloatDecimals(decimals);

Arguments

  1. decimals - (integer) the number of decimals of floating values

Returns

  • (InputDialog) this InputDialog

setIntegerStep

Sets the integer step value.

Syntax

myObject.setIntegerStep(step);

Arguments

  1. step - (integer) the integer step value

Returns

  • (InputDialog) this InputDialog

setMaximum

Sets the maximum value.

Syntax

myObject.setMaximum(maximum);

Arguments

  1. maximum - (mixed) the maximum value

Returns

  • (InputDialog) this InputDialog

setMinimum

Sets the minimum value.

Syntax

myObject.setMinimum(minimum);

Arguments

  1. minimum - (mixed) the minimum value

Returns

  • (InputDialog) this InputDialog

setRange

Sets the minimum and maximum values.

Syntax

myObject.setRange(minimum, maximum);

Arguments

  1. minimum - (mixed) the minimum value
  2. maximum - (mixed) the maximum value

Returns

  • (InputDialog) this InputDialog

setInputType

Sets the input type.

Syntax

myObject.setRange(inputType);

Arguments

  1. inputType - (InputType) the input type

Returns

  • (InputDialog) this InputDialog

setValue

Sets the value.

Syntax

myObject.setValue(value);

Arguments

  1. value - (mixed) the value

Returns

  • (InputDialog) this InputDialog

setItems

Sets the items that can be choosen from.

Syntax

myObject.setItems(items);

Arguments

  1. items - (array) the items that can be choosen from

Returns

  • (InputDialog) this InputDialog

setItemsEditable

Sets the items as editable.

Syntax

myObject.setItemsEditable(itemsEditable);

Arguments

  1. itemsEditable - (boolean) should the item list be editable

Returns

  • (InputDialog) this InputDialog

value

Returns the value.

Syntax

myObject.value();

Returns

  • (mixed) the value

show

Show the window. (non-blocking) Use the OnClosed event to know when the window has been closed.

Syntax

myObject.show();

Returns

  • (InputDialog) this InputDialog

showModal

Show the window. (blocking)

Syntax

myObject.showModal();

Returns

  • (integer) the window result (0 means that it has been canceled)

Events

onClosed

Called when the window is closed.

Syntax

myObject.onClosed = function(result) {};

Arguments

  1. result - (integer) the window result (0 means that it has been canceled)

Example

myObject.onClosed = function(result)
{
	if(result)
	{
		//Event action
	}
};

onValueChanged

Called when the value changes.

Syntax

myObject.onValueChanged = function(value) {};

Arguments

  1. value - (mixed) the current value

Example

myObject.onValueChanged = function(value)
{
	//Event action
};

Attributes

title

The window's title. (string)

position

The window's position. (Point)

opacity

The window's opacity. (float)

enabled

The window's enabled status. (boolean)

visible

The window's visible status. (boolean)

value

The window's value. (mixed)

Enumerations

InputType

The input type.

Values

  • Text: text
  • Integer: an integer
  • Float: a floating number (decimal)
  • Items: a list of items

TextEchoMode

The text echo mode.

Values

  • Normal: normal text display
  • NoEcho: do not show the text
  • Password: show password characters instead of the typed characters
  • PasswordEchoOnEdit: show password characters instead of the typed characters only when editing
en/code/windows/inputdialog.txt · Last modified: 2016/10/09 11:10 (external edit)