Step 1. Define a Picklist for iiiGRADE.
VFW090 – Field Visualizations
1. Copy field GRADE to create a new field iiiGrade, select the options to copy rules, visualization and help text. Open the new field in the editor.
2. Select the tab, which should contain a definition:
3. Add a using the toolbar button:
4. Select the component and define the following picklist values:
|
Caption |
Value |
Default |
|
Pass |
P |
Yes |
|
Fail |
F |
|
|
Merit |
M |
|
|
Distinction |
D |
|
5. Select the tab and change the field value to 'P', to correspond with the default value. See later in the exercise for more detail on this step.
6. On the tab, select the component. Note that it has defaulted to a suitable design, a .
Widen the visualization slightly so that the word "Distinction" would be shown.
If necessary, reduce the height to the minimum possible.
Note: Always make visualizations use the minimum space on the interface.
Select the tab and change the new visualization to = True.
7. Save your field definition.
8. Open iiiVFW19 – Employee Skill Detailer in the editor and select the tab. Position the cursor at the top of the code.
a. Display the dialog () and set it up to replace #GRADE with #iiiGrade. Do not .
b. Use , which will be this line:
Define_Com Class(#GRADE.Visual) Name(#GRADE) Displayposition(2) Height(21) Left(7) Parent(#DETAIL) Tabposition(2) Top(38) Usepicklist(False) Width(189)
b. Use to change both entries on this line. Your code should look like the following:
Define_Com Class(#iiiGRADE.Visual) Name(#iiiGRADE) Displayposition(2) Height(21) Left(7) Parent(#DETAIL) Tabposition(2) Top(38) Width(189)
c. You should now be positioned on this line:
Define_Com Class(#PRIM_FWLI) Name(#FWLI_7) Manage(#GRADE) Parent(#FWLM_2)
d. Replace #GRADE and the dialog.
9. You will now add code to set up iiiGrade from the real field GRADE.
a. At the top of the PHBN_SAVE.Click event routine add this code:
#GRADE := #iiiGrade
b. In the uShow method routine, add this code immediately after the FETCH
#iiiGrade := #GRADE
c. On the tab check the appearance of iiiGrade visualization and increase its width if necessary.
10. Recompile iiiVFW19 – Employee Skill Detailer.
11. Execute your Framework and display the command handler for an employee. Note that the Grade obtained for the skill field is now visualized as a dropdown.
Note:
- The will be automatically positioned to show the field's current value. If the field contains any value not in the picklist, such as blanks, the picklist will show its default caption.
- The field's value is only populated or changed by the visualization when an option is selected in the picklist (visualized as a dropdown in this case). This means if no selection is made, the fields value could be invalid.
Defining the field's to be the same as the picklist's default avoids this problem.