Table of Contents
var dialog = new Dialog; dialog.caption = "Name reading dialog"; dialog.okButtonText = "Done" dialog.cancelButtonText = "Abort"; var first = new LineEdit; first.label = "First name: "; dialog.add( first ); var last = new LineEdit; last.label = "Last name: "; dialog.add( last ); if( dialog.exec() ) { var fullName = last.text + ", " + first.text; print( "Full name is: " + fullName ); }Below is a list of the classes available from the Input Dialog Framework. Each class has a short description and a list of its properties and functions. For String properties the default is an empty string, and for Number properties the default is 0, unless stated otherwise.
checked : Boolean; This property holds whether the checkbox is checked. The default is unchecked, i.e. false.
text : String; This property holds the text shown on the button.
tooltip : String; This property holds the tool tip (balloon help) for the widget.
whatsThis : String; This property holds a simple description of the widget.
currentItem : String; This property is used in two ways: To specify the default selected item in the combobox; and to get the value the user selected in the combobox when the dialog is closed. The default is the first item in the list.
editable : Boolean; This property holds whether the combobox is editable. The default is false.
itemList : Array; The list of items in the combobox.
label : String; The label for the combobox.
tooltip : String; This property holds the tool tip (balloon help) for the widget.
whatsThis : String; This property holds a simple description of the widget.
date : Date; This property holds the editor's date value. The default is today.
label : String; The label for the date.
maximum : Date; This property holds the editor's maximum value. The default maximum date is 8000-12-31.
minimum : Date; This property holds the editor's minimum value. The default minimum date is 1752-09-14.
order : Order; This property holds the order in which the year, month and day appear. The default order is locale dependent.
tooltip : String; This property holds the tool tip (balloon help) for the widget.
whatsThis : String; This property holds a simple description of the widget.
caption : String; This property holds the window caption (title). The default is the application's name.
cancelButtonText : String; This property holds the text shown on the cancel button. The default is "Cancel".
okButtonText: String; This property holds the text shown on the ok button. The default is "Ok".
width : Number; This property holds the width of the widget excluding any window frame. The default is set by the layout.
tooltip : String; This property holds the tool tip (balloon help) for the widget.
whatsThis : String; This property holds a simple description of the widget.
add( widget : QSWidget ); Adds a widget to the dialog. Widgets are placed vertically, from top to bottom.
addSpace( space : Number ); Adds vertical space, measured in pixels between, the previous and next added widget.
exec() : Boolean;
Executes the dialog. This opens the dialog as a modal dialog,
blocking the application until the user presses the OK button or
the Cancel button to close the dialog. The function returns true
of the user pressed OK; otherwise it returns false
.
newColumn(); Creates a new column in the dialog. All widgets subsequently added to the dialog will be placed (vertically, from top to bottom), in the new column.
newTab( label : String ); Creates a new tab in the dialog with the given label. All widgets subsequently added to the dialog will be placed in the newly created tab, (vertically, from top to bottom).
title : String; This property holds the group box's title text.
tooltip : String; This property holds the tool tip (balloon help) for the widget.
whatsThis : String; This property holds a simple description of the widget.
add( widget : QSWidget ); Adds a widget to this groupbox.
addSpace( space : Number ); Adds vertical space, measured in pixels, between the previous and the next widget that is added.
newColumn(); Creates a new column within this groupbox. All widgets that are added subsequently will be placed in the new column.
addSpace()
decimals : Number; This property holds the number edits's maximum number of digits after the decimal point.
label : String; The label text for this number edit.
maximum : Number; This property holds the number edit's maximum acceptable value. The default is 2,147,483,647.
minimum : Number; This property holds the number edit's minimum acceptable value. The default is -2,147,483,647.
value : Number; This property holds the number edit's input value. The default is 0.
tooltip : String; This property holds the tool tip (balloon help) for the widget.
whatsThis : String; This property holds a simple description of the widget.
checked : Boolean; This property holds whether the radio button is checked. The default is unchecked (false).
text : String; This property holds the text shown on the button.
tooltip : String; This property holds the tool tip (balloon help) for the widget.
whatsThis : String; This property holds a simple description of the widget.
label : String; This property holds the spinbox's label text.
maximum : Number; This property holds the maximum value of the spin box. The default maximum value is 2,147,483,647.
minimum : Number; This property holds the minimum value of the spin box. The default minimum value is -2,147,483,648.
value : Number; This property holds the value of the spin box.
tooltip : String; This property holds the tool tip (balloon help) for the widget.
whatsThis : String; This property holds a simple description of the widget.
label : String; This property holds the time edit's label text.
maximum : Time; This property holds the maximum time value.
minimum : Time; This property holds the minimum time value.
showAMPM : Boolean; If this property is false (the default), the time edit uses the 24 hour clock; otherwise the time edit uses the 12 hour clock and displays AM or PM as appropriate.
showSeconds : Boolean; If this property is true (the default), the time edit displays seconds; otherwise it does not display seconds.
time : Time; This property holds the editor's time value.
tooltip : String; This property holds the tool tip (balloon help) for the widget.
whatsThis : String; This property holds a simple description of the widget.
FileDialog.getOpenFileName().
var ans = MessageBox.warning( "Do you wish to save the data?", MessageBox.Yes, MessageBox.No ); if (ans == MessageBox.Yes) { save(); }
NoButton; No button is displayed.
Ok; Displays an 'OK' button.
Cancel; Displays a 'Cancel' button.
Yes; Displays a 'Yes' button.
No; Displays a 'No' button.
Abort; Displays an 'Abort' button.
Retry; Displays a 'Retry' button.
Ignore; Displays an 'Ignore' button.
information( label : String,
button1 : ButtonType,
button2 : ButtonType,
button3 : ButtonType,
title : String );
Displays an information message box with the content specified in label.
warning( label : String,
button1 : ButtonType,
button2 : ButtonType,
button3 : ButtonType,
title : String );
Displays a warning message box with the content specified in label.
critical( label : String,
button1 : ButtonType,
button2 : ButtonType,
button3 : ButtonType,
title : String )
Displays a critical error message box with the content specified in label.
.txt.
var filename = FileDialog.getOpenFileName( "*.txt" ); if (filename) { processfile(filename); }
getOpenFileName( filter : String, title : String );
Opens an "Open" dialog. If filter
is specified (e.g.
"textfiles (*.txt)"), only those files which match the filter are
shown. The function returns a string with the selected filename, or
undefined
if the user canceled.
getSaveFileName( filter : String, title : String );
Opens an "Save As" dialog. If filter
is specified (e.g.
"textfiles (*.txt)"), only those files which match the filter are
shown. The function returns a string with the filename selected or
entered, or undefined
if the user canceled.
getExistingDirectory( dir : String, title : String );
Opens a "Find Directory" dialog for the user to select an existing
directory. The parameter dir
can be used to specify the initial
directory. Returns the name of the selected directory or undefined if the user canceled.
getOpenFileNames( dir : String, filter : String, title : String );
Opens an "Open" dialog for the user to select and open one or more
existing files. If dir
is specified it specifies the initial
directory. If filter
is specified (e.g. "textfiles (*.txt)"),
only those files which match the filter are shown. The function
returns a list of string string with the selected filenames, or undefined if the user canceled.
var name = Input.getText( "What is your surname? " ); if (name) { processname(name); }
getText( label : String,
text : String,
title : String );
Asks the user for a text. label
specifies the descriptive
label and text
specifies the default text. The function
returns the text entred by the user or undefined
if the user
canceled.
getNumber( label : String,
value : Number,
decimals : Number,
minValue : Number,
maxValue : Number,
title : String );
Asks the user for a number. label
specifies the descriptive
label, value
specifies the default value, decimals
specifies
the number of decimals allowed, minValue
specifies the minimum
value and maxValue
specifies the maximum value. The function
returns the value entered by the user or undefined
if the user
canceled.
getItem( label : String,
itemList : Array,
current : String,
editable : Boolean,
title : String );
Asks the user to select an item from a predefined list of values
specified by itemList.
The descriptive label is specified with label.
current
specifies the value that is selected when the dialog starts. If editable is true, the user is allowed to enter a value that is not
in the itemList.
The function returns the value selected or
entered by the user or undefined
if the user canceled.