====== 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 === - parameters - (object) window parameters * title - (string) the window's title * position - ([[en:code:core:point|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|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|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|OnClosed]]) event called when the window is closed * onValueChanged - ([[#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 === - title - (string) the window's title === Returns === * (InputDialog) this InputDialog ==== setPosition ==== Sets the window's position. === Syntax === myObject.setPosition(point); === Arguments === - point - ([[en:code:core:point|Point]]) the window's position === Returns === * (InputDialog) this InputDialog ==== setOpacity ==== Sets the window's opacity. === Syntax === myObject.setOpacity(opacity); === Arguments === - opacity - (float) the window's opacity === Returns === * (InputDialog) this InputDialog ==== setEnabled ==== Sets the window's enabled status. === Syntax === myObject.setEnabled(enabled); === Arguments === - enabled - (boolean) the window's enabled status === Returns === * (InputDialog) this InputDialog ==== setVisible ==== Sets the window's visible status. === Syntax === myObject.setVisible(visible); === Arguments === - 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 === * ([[en:code:core:point|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 === - text - (string) the label text === Returns === * (InputDialog) this InputDialog ==== setOkButtonText ==== Sets the ok button text. === Syntax === myObject.setLabelText(text); === Arguments === - text - (string) the ok button's label === Returns === * (InputDialog) this InputDialog ==== setCancelButtonText ==== Sets the cancel button text. === Syntax === myObject.setCancelButtonText(text); === Arguments === - text - (string) the cancel button's label === Returns === * (InputDialog) this InputDialog ==== setTextEchoMode ==== Sets the text echo mode. === Syntax === myObject.setTextEchoMode(textEchoMode); === Arguments === - textEchoMode - ([[#textechomode|TextEchoMode]]) the text echo mode === Returns === * (InputDialog) this InputDialog ==== setFloatDecimals ==== Sets the number of decimals of floating values. === Syntax === myObject.setFloatDecimals(decimals); === Arguments === - decimals - (integer) the number of decimals of floating values === Returns === * (InputDialog) this InputDialog ==== setIntegerStep ==== Sets the integer step value. === Syntax === myObject.setIntegerStep(step); === Arguments === - step - (integer) the integer step value === Returns === * (InputDialog) this InputDialog ==== setMaximum ==== Sets the maximum value. === Syntax === myObject.setMaximum(maximum); === Arguments === - maximum - (mixed) the maximum value === Returns === * (InputDialog) this InputDialog ==== setMinimum ==== Sets the minimum value. === Syntax === myObject.setMinimum(minimum); === Arguments === - minimum - (mixed) the minimum value === Returns === * (InputDialog) this InputDialog ==== setRange ==== Sets the minimum and maximum values. === Syntax === myObject.setRange(minimum, maximum); === Arguments === - minimum - (mixed) the minimum value - maximum - (mixed) the maximum value === Returns === * (InputDialog) this InputDialog ==== setInputType ==== Sets the input type. === Syntax === myObject.setRange(inputType); === Arguments === - inputType - ([[#inputtype|InputType]]) the input type === Returns === * (InputDialog) this InputDialog ==== setValue ==== Sets the value. === Syntax === myObject.setValue(value); === Arguments === - value - (mixed) the value === Returns === * (InputDialog) this InputDialog ==== setItems ==== Sets the items that can be choosen from. === Syntax === myObject.setItems(items); === Arguments === - items - (array) the items that can be choosen from === Returns === * (InputDialog) this InputDialog ==== setItemsEditable ==== Sets the items as editable. === Syntax === myObject.setItemsEditable(itemsEditable); === Arguments === - 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|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 === - 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 === - value - (mixed) the current value === Example === myObject.onValueChanged = function(value) { //Event action }; ===== Attributes ===== ==== title ==== The window's title. (string) ==== position ==== The window's position. ([[en:code:core:point|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