Class Reference dialog

a custom dialog to input values More...

Member

dialog()
int addComboBox(stringList item, string defaultitem="")
int addLabel(string)
int addLineEdit(string defaultText)
int addSpinBox(int defaultValue, int minValue, int maxValue )
int exec()
string getString(int id)
int getInt(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();

Member Function Documentation


dialog::dialog()

creates a new object


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

adds an 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::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.


int 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.


string dialog::getString(int id)

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


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.


void dialog::setWindowTitle(string s)

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