Step 1 Define a Picklist for iiiGRADE

VLF Windows Application Development

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 Visualization tab, which should contain a VisualEdit definition:

3.  Add a Static Picklist using the toolbar button:

4.  Select the Picklist component and define the following picklist values:

Caption

Value

Default

Pass

P

Yes

Fail

F

 

Merit

M

 

Distinction

D

 

 

5.  Select the Definition tab and change the field Default value to 'P', to correspond with the Static Picklist default value. See later in the exercise for more detail on this step.

6.  On the Visualization tab, select the VisualPicklist component. Note that it has defaulted to a suitable design, a Dropdown.

     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 Details tab and change the new visualization to Default Visual = True.

7.  Save your field definition.

8.  Open iiiVFW19 – Employee Skill Detailer in the editor and select the Source tab. Position the cursor at the top of the code.

a.  Display the Replace dialog (Ctrl+H) and set it up to replace #GRADE with #iiiGrade. Do not Replace All.

b.  Use Find Next, 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 Replace 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 Cancel the Replace 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 Design 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 Skills 2 command handler for an employee. Note that the Grade obtained for the skill field is now visualized as a dropdown.

Note:

  • The Static Picklist 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 Default value to be the same as the picklist's default avoids this problem.