Progress
Programming
Handbook
Attributes and Methods
At run time, a procedure can set or query combo box attributes to accomplish the following:
- Change the size of the list by setting the INNER–LINES attribute (Windows and character interfaces only). The value must be at least 3.
- Display all list items in sorted order by setting the SORT attribute (Windows and character interfaces only).
- Change the contents of the list with the LIST–ITEMS attribute, and change the delimiter that Progress uses to separate items in the list using the DELIMITER attribute.
- Change the format of combo box fill-in and list data with the FORMAT attribute. If you change the format after realization, then all items in the list are converted to the new format.
- Query or set the item currently selected in the list with the SCREEN–VALUE attribute. If nothing is selected, this attribute returns the null string (" "). If you set the attribute to an item not in the list, Progress ignores the setting and displays a warning message.
- Query the total number of items in the list with the NUM–ITEMS attribute.
- Query the data type of the combo box with the DATA–TYPE attribute. You can set this attribute before realization, but you lose all items currently in the list.
In addition to attributes, the combo box also supports list manipulation methods that allow a procedure to:
- Add an item to the beginning or end of the list with the ADD–FIRST( ) or ADD–LAST( ) methods.
- Delete an item (by value or index) with the DELETE( ) method.
- Insert an item or delimiter-separated item list (by value or index) with the INSERT( ) method.
- Replace an existing item (by value or index) with a new item (or delimiter-separated item list) with the REPLACE( ) method.
- Retrieve the item specified by an index with the ENTRY( ) method.
- Return the index of a specified item with the LOOKUP( ) method.
For example, the following procedure reads filenames into a combo box and uses the LIST–ITEMS attribute to change the contents of the list dynamically. To compare it with a similar procedure using a selection list, see the
p-sel2.p
procedure in the "Selection Lists" section.
This code allows you to select from a combo box of all the files and subdirectories within the specified directory. The
DLC
directory is the initial directory.
![]()
When you double click, press RETURN, or press
GO
on the Directory Pathname field, the procedure builds a list of the files in the combo box from the specified directory. When you select a new item in the list, the VALUE–CHANGED trigger executes. If the item is a file, the trigger displays your access to that file. If the item is a directory, the trigger rebuilds the combo box with the contents of that directory.Note that within the internal procedure, build–list, the list of file and directory names is built first, and then the LIST–ITEMS attribute is used to change the contents of the combo box. You could use the ADD–LAST( ) method within the REPEAT loop to add items to the combo box one at a time, but using LIST–ITEMS once is more efficient. Note, also, the use of the DELIMITER attribute to ensure that the list is built using the current list delimiter.
For more information on each attribute and method, see the Progress Language Reference .
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |