Kbase 19194: Combo-Box Defined With LIST-ITEM-PAIRS
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/15/2008 |
|
Status: Verified
GOAL:
How to use the LIST-ITEM-PAIRS attribute of a combo-box widget?
GOAL:
How to take the value that was selected in a drop-down-list and assign it to another variable at the time it's selected?
FACT(s) (Environment):
Progress 9.X
OpenEdge 10.x
FIX:
Starting with version 9, Progress introduced a new attribute, LIST-ITEM-PAIRS, for the combo-box widget.
The following code will display in separate fill-ins each element of an item-pair selected in the combo-box:
DEFINE VARIABLE cb1 AS CHARACTER FORMAT "X(256)":U
LABEL "Combo 1" VIEW-AS COMBO-BOX INNER-LINES 3
LIST-ITEM-PAIRS "Item 1","description 1",
"Item 2","description 2",
"Item 3","description 3"
SIZE 30 BY 1 NO-UNDO.
DEFINE VARIABLE fi1 AS CHARACTER FORMAT "X(256)":U
LABEL "Screen-Value" VIEW-AS FILL-IN SIZE 30 BY 1 NO-UNDO.
DEFINE VARIABLE fi2 AS CHARACTER FORMAT "X(256)":U
LABEL "Combo Value" VIEW-AS FILL-IN SIZE 30 BY 1 NO-UNDO.
DEFINE FRAME fr1
cb1 AT ROW 1.48 COL 16 COLON-ALIGNED
fi1 AT ROW 2.67 COL 16 COLON-ALIGNED
fi2 AT ROW 3.86 COL 16 COLON-ALIGNED
WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
SIDE-LABELS NO-UNDERLINE THREE-D
AT COL 1 ROW 1 SIZE 55.2 BY 4.48.
ON VALUE-CHANGED OF cb1 IN FRAME fr1 DO:
ASSIGN fi1 = CB1:SCREEN-VALUE
fi2 = ENTRY((CB1:LOOKUP(FI1) * 2) - 1, CB1:LIST-ITEM-PAIRS,
CB1:DELIMITER).
DISPLAY fi1 fi2 WITH FRAME fr1.
END.
DO ON ERROR UNDO, LEAVE
ON END-KEY UNDO, LEAVE :
DISPLAY cb1 fi1 fi2 WITH FRAME fr1.
ENABLE cb1 fi1 fi2 WITH FRAME fr1.
WAIT-FOR CLOSE OF THIS-PROCEDURE.
END.