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 INPUT, INPUT ARRAY, and DISPLAY ARRAY dialogs (e.g., enable or disable actions and form fields dynamically during the dialog execution).
They cannot be used outside user interaction statements.
Available methods
General ui.Dialog methods
Field manipulation methods
ui.Dialog.setArrayAttributes() |
ui.Dialog methods are applied to variables of the corresponding - ui.Dialog - type.
ui.Dialog objects can be used and manipulated in two ways:
In the first case - within a user interaction statement - ui.Dialog method 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
In the second case - within a user-defined function - you must use a variable:
DEFINE myvar ui.Dialog
...
CALL myvar.setFieldActive("custid", 0)
Wrong call:
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.