| Tutorial Chapter 5: Enhancing the Form | |
Calls to the setActionActive method from the
ui.Dialog class have been added to
custmain.4gl to disable and enable menu
actions appropriately to give the user visual cues. An additional
ON ACTION statement exits the menu if the user
selects
.
01
02 MAIN
03 DEFINE query_ok SMALLINT
04
05 DEFER INTERRUPT
06 CONNECT TO "custdemo"
07 CLOSE WINDOW SCREEN
08 CALL ui.Interface.setImage("smiley")
09 OPEN WINDOW w1 WITH FORM "custform"
10
11 LET query_ok = FALSE
12
13 MENU
14 BEFORE MENU
15 CALL DIALOG.setActionActive("next",0)
16 CALL DIALOG.setActionActive("previous",0)
17 ON ACTION find
18 CALL DIALOG.setActionActive("next",0)
19 CALL DIALOG.setActionActive("previous",0)
20 CALL query_cust() RETURNING query_ok
21 IF (query_ok) THEN
22 CALL DIALOG.setActionActive("next",1)
23 CALL DIALOG.setActionActive("previous",1)
24 END IF
25 ON ACTION next
26 CALL fetch_rel_cust(1)
27 ON ACTION previous
28 CALL fetch_rel_cust(-1)
29 ON ACTION quit
30 EXIT MENU
31 ON ACTION close
32 EXIT MENU
33 END MENU
34
35 CLOSE WINDOW w1
36
37 DISCONNECT CURRENT
38
39 END MAIN
in the top right of the
window, the action on line 32, EXIT
MENU, will be taken.