INPUT operator
The INPUT operator creates an action that inputs a primitive value or selects an object of a custom class.
Syntax
INPUT inputOptions [LIST listExpr]
[CHANGE [= changeExpr]]
[DO actionOperator [ELSE elseActionOperator]]
inputOptions - input options. Specified by one of the following syntaxes:
[alias =] className
[alias] = expr
Description
The INPUT operator creates an action which allows to request the value of one of the built-in classes from the user.
If className is a custom class, the operator requests an object of that class. Without an explicit LIST, interactive input opens the class selection form, while a programmatically supplied value is interpreted as the object's id. An explicit LIST offers the values of listExpr for selection (for example LIST name(o)); the value class of listExpr determines the inline editor.
Parameters
-
classNameThe name of a built-in class or a custom class. For a custom class, the input requests an object of that class.
-
listExprAn expression whose values are offered for selection. Used for a custom-class input to list candidate objects (the value class of
listExprdetermines the inline editor). -
exprAn expression, which value determines the initial value of the input.
-
aliasThe name of the local parameter to which the input result is written. Simple ID.
-
CHANGEA keyword specifying that in addition to the value input the result needs to be written to the specified property.
-
changeExprAn expression that determines the property to which the input result is written. By default, the property specified as the initial input value is used.
-
actionOperatorA context-dependent action operator that is executed if the input was completed successfully.
-
elseActionOperatorA context-dependent action operator that is executed if the input was cancelled. The input result parameter cannot be used as parameters.
Examples
changeCustomer (Order o) {
INPUT s = STRING[100] DO {
customer(o) <- s;
IF s THEN
MESSAGE 'Customer changed to ' + s;
ELSE
MESSAGE 'Customer dropped';
}
}
FORM order
OBJECTS o = Order
PROPERTIES(o) customer ON CHANGE changeCustomer(o)
;
testFile {
INPUT f = FILE DO { // requesting a dialog to select a file
open(f); // opening the selected file
}
}