Sample: Creating a Wizard
The following example shows how to implement a simple wizard for creating a group.
Example |
app.ducx Object Model Language // The graddmemebers property is used to add members to the group // within the second wizard step extend class Group { unique Object[] graddmembers { allow { User create; } } } app.ducx User Interface Language // The form contains the two form pages that are displayed in the first // and second wizard step form FormGroupCreateGroupWizApp { audience = enduser; formpage PageGroupCreateGroupWizApp { audience = enduser; dataset { grlongname; grshortname; grsupergroups; grorgunittype; objexternalkey; } } formpage PageMembersCreateGroupWizApp { audience = enduser; dataset { graddmembers; } } } app.ducx Use Case Language override InitializeCreatedObject { variant Group { impl = application { expression { Object venv_object; Object venv_parent; integer venv_index; Object venv_view; Object venv_action; WizardContext[] @venv_wizardctx; Object @group; venv_object.ObjectLock(true, true); if (venv_parent.HasClass(#Group) && venv_view == #grsubgroups) { venv_object.grsupergroups = venv_parent; } @group = venv_object; // Creates the wizard context @venv_wizardctx = [ {@group, #FormGroupCreateGroupWizApp, #ShowWizardApp} ]; // Calls the wizard; the parameters are defined in the // FSCVENV@1.1001:WizardPrototype ->DoWizardApp(venv_object, venv_parent, venv_index, venv_view, venv_action, @venv_wizardctx); venv_object.AddUserRole(venv_object.graddmembers, #StaffPos, venv_object); venv_object.graddmembers = null; } } } } // When creating a group the implementation of InitializeCreatedObject // gets executed override InitializeCreatedObjectDoDefault { variant Group { // GroupInitializeCreatedObject is implicitely generated // from InitializeCreatedObject with variant Group impl = GroupInitializeCreatedObject; } } |
The wizard context is a compound property list, used to define the sequence of the wizard. The compound type FSCVENV@1.1001:WizardContext consists of following properties:
- FSCVENV@1.1001:wizardobject
Object containing the data. - FSCVENV@1.1001:wizardform
Form or form page filtered according user profile and access check (AccTypeSearch). - FSCVENV@1.1001:wizardapplication
Application used for this wizard step. You can use the generic implementation FSCVENV@1.1001:ShowWizardApp, or create your own application with the proper prototype. Inside the application it is up to you to call FSCVENV@1.1001:ShowWizardApp to display the form pages. - FSCVENV@1.1001:wizardpageidx
This parameter is used internally. It stores the form page visited lastly. - FSCVENV@1.1001:wizardpages
This parameter is used internally. It stores the form pages that should be displayed depending on the access check and user profile. - FSCVENV@1.1001:wizardcxtvisited
This parameter is used internally. It stores whether this context line has been visited before. - FSCVENV@1.1001:wizardreadonly
This parameter defines whether the form pages defined in this context line should be displayed read-only. - FSCVENV@1.1001:wizardoptional
This parameter defines whether this context line and all following context lines are optional. If a context line is optional a finish branch will be displayed.