Consultor Eletrônico



Kbase P113550: How to retrieve the unformatted value of a COMBO-BOX or SELECTION-LIST selection
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   7/25/2007
Status: Unverified

GOAL:

How to retrieve the unformatted value of a COMBO-BOX selection

GOAL:

How to retrieve the unformatted value of a SELECTION-LIST selection

FIX:

Unlike the FILL-IN widget, referencing the widget name will not return the full unformatted value. To obtain the unformatted value of a COMBO-BOX or SELECTION-LIST you must use the widgets ENTRY Method. For example, the following code displays the position and value of the currently selected entry of a LIST-ITEM-PAIRS COMBO-BOX widget:
DEFINE VARIABLE iEntryPosition AS INTEGER NO-UNDO.
DEFINE VARIABLE cEntryItself AS CHARACTER NO-UNDO.
ASSIGN
iEntryPosition = (LOOKUP(COMBO-BOX-1:SCREEN-VALUE, COMBO-BOX-1:LIST-ITEM-PAIRS, COMBO-BOX-1:DELIMITER) - 1 )
cEntryItself = ENTRY(iEntryPosition, COMBO-BOX-1:LIST-ITEM-PAIRS, COMBO-BOX-1:DELIMITER).
MESSAGE
"Entry Position:" "~t" iEntryPosition "~n"
"Entry Value:" "~t" cEntryItself
VIEW-AS ALERT-BOX INFO BUTTONS OK TITLE "LIST-ITEM-PAIRS COMBO-BOX Selected Entry Position and Value".
The following code displays the value and the position and value of the currently selected entry of a LIST-ITEMS SELECTION-LIST widget:
DEFINE VARIABLE iEntryPosition AS INTEGER NO-UNDO.
DEFINE VARIABLE cEntryItself AS CHARACTER NO-UNDO.
ASSIGN
cEntryItself = SELECT-1:SCREEN-VALUE IN FRAME {&FRAME-NAME}
iEntryPosition = LOOKUP(SELECT-1:SCREEN-VALUE, SELECT-1:LIST-ITEMS, SELECT-1:DELIMITER).

MESSAGE
"Entry Position:" "~t" iEntryPosition "~n"
"Entry Value:" "~t" cEntryItself
VIEW-AS ALERT-BOX INFO BUTTONS OK TITLE "LIST-ITEMS SELECTION-LIST Selected Entry Position and Value" .