Usage / Programming with DIALOG |
By default, dialog actions are enabled, to let the user invoke the action handler by clicking on the corresponding action view (button) or by pressing its accelerator key. In most situations actions remain active during the whole dialog execution. However, to follow GUI standards, actions must be disabled when not allowed in the current context. For example, a print action should be disabled if no record is currently shown in the form. But after a query, when the form is filled with a given record, the print action must be activated.
DIALOG ATTRIBUTES(UNBUFFERED) ... BEFORE DIALOG CALL DIALOG.setActionActive( "print", FALSE ) ... ON ACTION query -- query the database and fill the record ... CALL DIALOG.setActionActive( "print", (cust_id IS NOT NULL) ) ... END DIALOG
Consider centralizing action activation / deactivation in a setup function specific to the dialog, passing the DIALOG object as parameter.
Some predefined dialog actions such as insert / append / delete of INPUT ARRAY are automatically enabled/disabled according to the context. For example, if the maximum number of rows (MAXCOUNT) is reached, insert and append are disabled.