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 FUNCTIONNote:
- Line
01Three 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
04and05use theui.Dialog.setActionActivemethod to enable or disablenextandpreviousactions based on the value ofquery_ok, which indicates whether the search for orders was successful. - Line
06uses the same method to enable thegetitemsaction based on the value ofhas_order, which indicates whether there is an order currently selected.