Progress
Language Tutorial
for Windows
Selection-list Programming Example
Although the selection list is valuable for presenting a list of known choices to a user, it becomes essential as a way to display acceptable choices that aren’t known until run time. The process of filling the list of choices at run time is known as populating. Populating involves two major steps:
All Around Sports is a growing business, and the responsibilities of its sales people are changing to meet the new challenges. The sales director asks you to design a simple interface so that she can quickly view and change sales representative assignments.
Follow these steps to view a sales representative selection list:
- Open
lt-07-08.p
and run it. The following display appears:
![]()
- Click an item to choose it. The form does not update. If the trigger in the procedure used VALUE-CHANGED, it would have.
- Double-click a sales representative name, Progress accesses the appropriate record from the sports database and displays some of the fields. The double-click event executes the DEFAULT-ACTION trigger for the selection list.
- Choose Exit, then press SPACEBAR to return to the Procedure Editor.
This is the code that created the interface:
These notes help to explain the code:
- Note that the initial definition of the selection list does not include the LIST-ITEMS.
- By using DEFAULT-ACTION, the fields in the form do not update until the user double-clicks a list item or presses RETURN or SPACEBAR. The FIND statement, which you’ll learn about in the next chapter, accesses the appropriate sales representative record.
- Since the names in the Salesrep table may contain commas, you have to set the LIST-ITEM delimiter to some character that won’t be in the data. You choose the asterisk.
- The FOR EACH block cycles through each record in the Salesrep table.
- The ADD-LAST( ) method adds the current Salesrep name to the bottom of the list. Since the SORT option is also employed, Progress will sort the list items before you display the widget.
- This FIND statement accesses a record so that some data appears at startup.
NOTE: Keep in mind that ToolTip information can be added to any selection list widget. Refer to the code examples in either the Toggle Box Programming Example or the Radio Set Programming Example presented earlier in this chapter that show how to define the TOOLTIP option.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |