Using Dropdowns, List Boxes, and Combo Boxes
Sample code:
Display file source:Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â PUISAMPLES/QDDSSRC(CUSTINQ5D)
RPGLE source:Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â PUISAMPLES/QRPGLESRC(CUSTINQ5R)
Dropdowns, list boxes, and combo boxes are appropriate input controls when the user has a limited set of choices to select from. A dropdown or combo box only shows the list when the user activates it, while a list box shows the list at all times. Unlike the dropdown, a combo box also allows users to type a value directly into the component in addition to being able to select it from the list.
In Profound UI, there are several ways to specify the list of choices. Choices can also be associated with values that are to be sent to the server. For example, you may want the user to select a customer name, but to process the corresponding customer number in the RPG code. Just like with textboxes and other input controls, the value property should be bound to the RPG variable that is to receive the value selected by the user.
Static choices
To specify a static list of options, prompt the choices property, and provide a list of hard-coded options in the Edit Choices dialog.
In addition, if the values sent to the server are different than the set of options presented to the user, prompt the choice values property, and specify a list of values that correspond to the choices.Dynamic choices populated by RPG
To populate choices dynamically, bind the choices property and optionally the choice values property to RPG fields. In the RPG code, populate the fields with a comma separated list of values.Dynamic database-driven choices
To populate choices from a database dynamically, without writing any RPG code, specify the choices database file, the choice options field, and the choice values field properties in the database-driven selection area of the Properties Window. You may also specify selection criteria, whether the first option should be a blank option, an order by field, and the maximum number of choices. For example, in the customer inquiry example above, we can replace the textbox with a dropdown, and specify the following properties:
The resulting dropdown field will appear as shown below:Dynamic choices populated by a web service
A widget’s choices can also be populated by an external http request to a web service that outputs the choices in JSON format. This is accomplished through the choices url property.