Example: comutils.4gl

The cimutils.4gl module defines a set of utility functions that can be reused in other programs.

The comutils.4lg module:
  1 PUBLIC FUNCTION mbox_ok(qt STRING, msg STRING) RETURNS ()
  2   MENU qt ATTRIBUTE (STYLE="dialog",COMMENT=msg)
  3     COMMAND "OK"
  4       EXIT MENU
  5   END MENU
  6 END FUNCTION
  7 
  8 PUBLIC FUNCTION mbox_yn(qt STRING, msg STRING) RETURNS BOOLEAN
  9   DEFINE r BOOLEAN
 10   MENU qt ATTRIBUTE (STYLE="dialog",COMMENT=msg)
 11     COMMAND "Yes"
 12       LET r = TRUE
 13       EXIT MENU
 14     COMMAND "No"
 15       LET r = FALSE
 16       EXIT MENU
 17   END MENU
 18   RETURN r
 19 END FUNCTION
Note:
  • Lines 1 thru 6 define the mbox_ok function to show a dialog box to the user, with an OK button.
  • Lines 8 thru 19 define the mbox_yn function display a dialog box, to let the user answer a question with Yes/No buttons.