Kbase P89095: How to create a dynamic button with a trigger in 4GL?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  7/23/2004 |
|
Status: Unverified
GOAL:
How to create a dynamic button with a trigger in 4GL?
FIX:
To create a button widget dynamically, use the CREATE <widget> statement. The general syntax for this statement is:
CREATE { BUTTON | COMBO-BOX
| CONTROL-FRAME | DIALOG-BOX
| EDITOR | FILL-IN
| FRAME | IMAGE
| MENU | MENU-ITEM
| RADIO-SET | RECTANGLE
| SELECTION-LIST | SLIDER
| SUB-MENU | TEXT
| TOGGLE-BOX | WINDOW
| VALUE ( string-expression )
} widget-handle [ IN WIDGET-POOL pool-name ]
[ ASSIGN { attribute = expression } ... ]
[ trigger-phrase ]
The following procedure creates a dynamic button that displays a list of customer names. To run it connect to the Sports2000 database:
DEFINE VARIABLE but1 AS WIDGET-HANDLE.
DISPLAY "Dynamic Button Example" SKIP(3) WITH FRAME x SIDE-LABELS.
OPEN QUERY all-custs FOR EACH Customer.
GET FIRST all-custs.
DISPLAY Customer.Name WITH FRAME x.
CREATE BUTTON but1
ASSIGN ROW = 3
COLUMN = 5
LABEL = "Next Customer"
FRAME = FRAME x:HANDLE
SENSITIVE = TRUE
VISIBLE = TRUE
TRIGGERS:
ON CHOOSE
DO:
GET NEXT all-custs.
DISPLAY Customer.Name WITH FRAME x.
END.
END TRIGGERS.
WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.