Class Reference dialog

a custom dialog to input values More...

Member

dialog()
int addCheckBox(string label,bool state=false)
int addComboBox(stringList item, string defaultitem="")
int addLabel(string)
int addLayer( int defaulLayer)
int addLineEdit(string defaultText)
int addSpinBox(int defaultValue, int minValue, int maxValue )
int addDoubleSpinBox(double defaultValue, double minValue, double maxValue, double step, double decimals )
int exec()
bool getBool(int id)
double getDouble(int id)
int getInt(int id)
string getString(int id)
void setWindowTitle(string s)

Detailed Description

A custom input dialog. The dialog class was introduced with release 20200601. The widget of the dialog are added line by line. After composing the dialog will be displayed by calling the exec method.

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();

The class dialog is available in C++ macros only. For Python and Ruby scripting please use dialog extensions of these scripting languages.

Member Function Documentation


dialog::dialog()

creates a new object


int dialog::addCheckBox(string label,bool state=false)

adds a checkBox to the dialog. With the returned id value the entered data can be read out.(introduced with release 20220602)


int dialog::addComboBox(stringList item, string defaultitem="")

adds a comboBox to the dialog. With the returned id value the entered data can be read out.


int dialog::addLabel(string)

adds a label to the dialog


int dialog::addLayer( int defaulLayer)

adds a layer entry to the dialog (introduced with release 20220712)

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();

layer_dialog


int dialog::addLineEdit(string defaultText)

add a lineEdit to the dialog. With the returned id value the entered line can be read out


int dialog::addSpinBox(int defaultValue, int minValue, int maxValue )

adds a spin box to enter integer numbers.

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();

spin_box


int dialog::addDoubleSpinBox(double defaultValue, double minValue, double maxValue, double step, double decimals )

adds a spin box to enter double numbers (introduced with release 20240301.


int dialog::exec()

displays the dialog to the user and terminated the macro execution until the dialog is closed. The returned number gives the button used to close the dialog.


bool dialog::getBool(int id)

Return: the state of the check box. (introduced with release 20220602)


double dialog::getDouble(int id)

Return: the value entered into an double spin box. In case the id number represents an string entry element, the entered string is converted to a double. (introduced with release 20240301)


int dialog::getInt(int id)

Return: the value entered into an integer spin box. In case the id number represents an string entry element, the entered string is converted to a integer.


string dialog::getString(int id)

Return: the string entered into the widget with id, integer values are converted to a string


void dialog::setWindowTitle(string s)

set the title of the dialog display inside the top bar.