User interaction with MENU

Your form can display options to the user using action views - buttons, dropdown menus (aka topmenus), toolbars, and other items on the window.

Defining Actions - the MENU statement

An action handler defined in the .4gl module identifies as set of instructions to be executed, and is associated with each action view shown on the form.
  • In this BDL program, the MENU statement defines a set of action handlers and the statements to be executed for each action. The action handlers can be specified with the COMMAND clause or with the ON ACTION clause:
    ON ACTION query
      CALL query_cust()
    The COMMAND clause is a shorthand to define the action name, action text and action help text. Best practice is to use ON ACTION.
  • The ON ACTION clause defines the action name and the statements to be executed for the action. The presentation attributes - title, font, comment, etc. - for the graphical object that serves as the action view are defined in a separate action defaults file, or in the ACTION DEFAULTS section of the form file. This allows you to standardize the appearance of the views for common actions. Action Defaults are illustrated in Tutorial Chapter 5: Enhancing the UI.

    You can also use ON ACTION clauses with some other interactive BDL statements, such as INPUT, DISPLAY ARRAY, INPUT ARRAY, and DIALOG.

  • When the MENU statement in your program is executed, the action views for the actions (query, in the example) that are listed in the interactive MENU statement are enabled. Only the action views for the actions in the specific MENU statement are enabled, so you must be sure to include a means of exiting the MENU statement. If there is no action view defined in your form specification file for a listed action, a simple push button action view is automatically displayed in the window (such button is a default action view). Control is turned over to the user, and the program waits until the user responds by selecting one of enabled action views or exiting the form. Once an action view is selected, the corresponding program routine (action) is executed.

Go to Ring menus (MENU) in the Genero Business Development Language User Guide for a complete discussion of the statement and all its options.

Displaying Messages and Errors

The MESSAGE and ERROR statements are used to display text containing a message to the user. The text is displayed in a specific area, depending on the front end configuration and window style. The MESSAGE text is displayed until it is replaced by another MESSAGE statement or field comment. You can specify any combination of variables and strings for the text. BDL generates the message to display by replacing any variables with their values and concatenating the strings:
MESSAGE SFMT("Customer num %1 retrieved.", l_custrec.cust_num)

The Localized Strings feature can be used to customize the messages for specific user communities.