Function setup_actions

This function is used by the main menu to enable or disable actions based on the context.

Function setup_actions (orders.4gl):
01 FUNCTION setup_actions(d, has_order, query_ok)
02   DEFINE d ui.Dialog,
03          has_order, query_ok SMALLINT
04   CALL d.setActionActive("next",query_ok)
05   CALL d.setActionActive("previous",query_ok)
06   CALL d.setActionActive("getitems",has_order)
07 END FUNCTION
Note:
  • Line 01 Three parameters are passed to the function:
    • d - the predefined Dialog object
    • has_order - if the value is TRUE, indicates that there is a new or existing order selected.
    • query_ok - if the value is TRUE, indicates that the search for orders was successful.
  • Lines 04 and 05 use the ui.Dialog.setActionActive method to enable or disable next and previous actions based on the value of query_ok, which indicates whether the search for orders was successful.
  • Line 06 uses the same method to enable the getitems action based on the value of has_order, which indicates whether there is an order currently selected.