Consultor Eletrônico



Kbase P37548: How to use the INSERT() method to add an item at the end of
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   23/09/2003
Status: Unverified

GOAL:

How to use the INSERT() method to add an item at the end of a TTY COMBO-BOX widget?

FIX:

The GUI COMBO-BOX INSERT() method adds an item at the end of the list using the syntax:

ComboBoxName:INSERT("asomeValue", ComboBoxName:NUM-ITEMS).

This syntax does not work with the character (CHUI) COMBO-BOX. One solution is:

a. Append a temporary item at the end of the list using the ADD-LAST() method.
b. Insert the real data item before the temporary item
c. Delete the temporary item using the DELETE() method:


/****** 1. Using the Combo-Box Name *****/
ON 'value-changed':U OF ComboBoxName
DO:
ComboBoxName:ADD-LAST("").
ComboBoxName:INSERT("asomeValue", ComboBoxName:NUM-ITEMS).
ComboBoxName:DELETE(ComboBoxName:num-items).
END.

/****** 2. Using the Combo-Box Handle*****/

DEFINE VARIABLE hComboBoxHandle AS HANDLE NO-UNDO.
...
hComboBoxHandle = ComboBoxName:HANDLE.
ON 'value-changed':U OF ComboBoxName
DO:
hComboBoxHandle:ADD-LAST("").
hComboBoxHandle:INSERT("asomeValue", hComboBoxHandle:NUM-ITEMS).
hComboBoxHandle:DELETE(hComboBoxHandle:num-items).
END.