a custom dialog to input values More...
A dialog is a local input window you construct in a C++ macro: dialog d; then add widgets line by line. addLabel, addLineEdit, addSpinBox, addComboBox, addCheckBox, addLayer, and addDoubleSpinBox each return an integer id. exec shows the dialog and pauses the macro until the user closes it; that return value is the button used to close. After exec, getString, getInt, getBool, and getDouble read the widget with that id. setWindowTitle sets the text in the title bar. It exists only for LayoutEditor C++ macros; Python scripts use the dialog facilities of that language.
Example:

dialog d;
d.setWindowTitle("Window Title");
d.addLabel("My text can be entered here!");
d.addLabel("Next line of text....");
stringList sl;sl.append("item1");sl.append("item2");sl.append("item3");
int cb=d.addComboBox(sl,"item3");
d.addLabel("Please enter a number");
int sb=d.addSpinBox(10,2,30);
d.addLabel("Please enter a text:");
int le=d.addLineEdit("text");
int ret= d.exec();
debug.clear();
debug("comboBox selection was:");
debug(d.getString(cb));
debug("spinBox number was:");
debug(d.getInt(sb));
debug("lineEdit text was:");
debug(d.getString(le));
debug("dialog closed with button:");
debug(ret);
debug.show();
Creates a new empty dialog. Widgets are added afterwards; nothing is shown until exec.
Adds a check box with caption label and initial state. Store the returned id and pass it to getBool after exec. (introduced with release 20220602)
Returns: the widget id.
| Parameter: | |
|---|---|
| label | label |
| state | state |
Adds a combo box filled from item. defaultitem is selected if it is in the list.
| Parameter: | |
|---|---|
| item | entries shown in the combo box |
| defaultitem | initial selection; empty selects the first item |
Returns: the widget id for getString after exec.
Adds a label line to the dialog.
Returns: the widget id.
Adds a layer picker. defaulLayer is the layer number shown first. After exec, getInt is the layer number and getString is the layer name. (introduced with release 20220712)
Returns: the widget id.
Example:
dialog d;
d.setWindowTitle("Window Title");
d.addLabel("Please enter a layer:");
int ll=d.addLayer(5);
int ret= d.exec();
debug.clear();
debug("comboBox selection was:");
debug("layer entry was:");
debug(d.getString(ll)+" ("+d.getInt(ll)+")"); // outputs: layername (layernumber)
debug.show();

Adds a single-line text field with defaultText. After exec, getString returns the text.
Returns: the widget id.
Adds a spin box for an integer between minValue and maxValue, starting at defaultValue.
| Parameter: | |
|---|---|
| defaultValue | initial value |
| minValue | lower limit |
| maxValue | upper limit |
Returns: the widget id for getInt after exec.
Example:
dialog d;
d.setWindowTitle("Window Title");
d.addLabel("Please enter a number between 1 and 10:");
int ll=d.addSpinBox(5,1,10);
int ret= d.exec();

Adds a spin box for a floating-point number. (introduced with release 20240301)
| Parameter: | |
|---|---|
| defaultValue | initial value |
| minValue | lower limit |
| maxValue | upper limit |
| step | increment of the spin buttons |
| decimals | number of digits after the decimal point |
Returns: the widget id for getDouble after exec.
Shows the dialog and pauses the macro until it is closed.
Returns: the button used to close the dialog.
Returns: the state of the check box with id. (introduced with release 20220602)
Returns: the value of a double spin box with id. If id is a string widget, the text is converted to a double. (introduced with release 20240301)
Returns: the value of an integer spin box with id. If id is a string widget, the text is converted to an integer.
Returns: the string of the widget with id. Integer values are converted to a string.
Sets the title shown in the dialog's top bar to s.