Example: (custmain.4gl)
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 
.
Module
custmain.4gl:
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 MAINNote:
- Line
08The icon for the application windows is set to the "exit" image. - Lines
15,16Before the menu is first displayed, thenextandpreviousactions are disabled. - Lines
18,19Before thequery_custfunction is executed thenextandpreviousactions are disabled - Lines
21thru24If the query was successful thenextandpreviousactions are enabled. - Line
31Thecloseaction is included in the menu, although an action view won't display on the form. If the user clicks the
in the top right of the window, the action on line32,EXIT MENU, will be taken.