Using the input dialog
The input dialog can accept data of any type, including integer, double, and text. In this recipe, we will learn to get text from the user. We will make use of an input dialog to know the name of the country in which the user lives.
The input dialog box will display a combo box showing different country names. On choosing a country by name, the chosen country name will appear in the textbox.
How to do it...
Let's create a new application based on the Dialog without Buttons template by performing the following steps:
- Since the application will prompt the user to choose the country that he/she lives, via input dialog, so drag and drop one
Labelwidget, oneLine Editwidget, and onePush Buttonwidget onto the form. - Set the
textproperty of theLabelwidget toYour Country. - Set the
textproperty of thePush Buttonwidget toChoose Country. - Set the
objectNameproperty of theLine Editwidget tolineEditCountry. - Set the
objectNameproperty of thePush Buttonwidget topushButtonCountry...