ui.Dialog methods provide additional control to the following user interaction statements, used within a DIALOG … END DIALOG block:
ui.Dialog methods are used during multiple input and display dialogs combined in the DIALOG statements (e.g., enable or disable actions and form fields dynamically during the dialog execution).
They cannot be used outside user interaction statements.
General ui.Dialog methods
|
Field manipulation methods
|
||
ui.Dialog.setDefaultUnbuffered() |
ui.Dialog methods are applied to the corresponding object - ui.Dialog.
ui.Dialog objects can be used and manipulated in two ways:
within a user interaction statement, or
within a user-defined function.
In the first case - within a user interaction statement - ui.Dialog object is predefined by the keyword, DIALOG, and doesn't need additional initialization or binding:
INPUT ARRAY myarr FROM scrarr.*
ON ACTION ("action")
CALL DIALOG.setFieldActive("custid", 0)
END INPUT
After the end of interaction statement, the ui.Dialog object is destroyed and its references become invalid. That is why a DIALOG keyword used outside an interaction statement will cause a compile-time error.
However, you can create a user-defined function that will serve as a dialog manipulation code and will be used for several interaction operations. In this case - within a user-defined function - you can create a ui.Dialog object beyond the user interaction block and declare its instance with the DEFINE statement:
INPUT ARRAY myarr FROM scrarr.*
BEFORE INPUT
CALL dialog_setup(DIALOG)
END INPUT
FUNCTION dialog_setup(dlg)
DEFINE dlg ui.Dialog
IF user.group = "admin" THEN
CALL dlg.setActionActive("delete", 1)
CALL dlg.setActionActive("modify", 1)
CALL dlg.setActionActive("link", 1)
ELSE
CALL dlg.setActionActive("delete", 0)
CALL dlg.setActionActive("modify", 0)
CALL dlg.setActionActive("link", 0)
END IF
END FUNCTION
Thus, you can use either a predefined ui.Dialog object within an interactive statement, or define a custom ui.Dialog object.
Related articles: