Step 4 Complete Monthly Command Handler

VLF Windows Application Development

Step 4. Complete Monthly Command Handler

VFW106 – Using a List Collection

1. Switch to the reusable part iiiVFW32 in the editor (Monthly Command Handler for Reports).

2. In the Design view, drag and drop the Selected Employees form, iiiVFW33 onto the panel. This will create a Define_Com for the component. Change its Name to #Selected_Employees.

3. Complete the SelectionChanged method to invoke the Selected_Employees form's uShow method, passing the list collection (with the name SELECTION).

     Your code should look like the following. New code is highlighted in red.

Mthroutine Name(SelectionChanged)
Define_Com Class(#PRIM_LCOL<#iiivfw33>) Name(#SELECTION)
Selectlist Named(#EMP_VIEW)
Continue If(*Not #EMP_VIEW.CURRENTITEM.SELECTED)
#SELECTION.INSERT( #EMPLOYEES<#EMPNO> )
Endselect
* Show the selected employees form
#Selected_Employees.uShow( #SELECTION )
Endroutine
 

4. Compile the reusable part iiiVFW32.

5. Execute the Framework as Designer.

6. Open the Properties dialog for the Reports business object.

7. Select the Commands Enabled tab.

8. Select the Monthly action and plug in the Reports Monthly command handler, iiiVFW32. Use the Find dialog, which will plug in using the Identifier.

9. Save and Restart the Framework.

10. Select the Reports business object. The Weekly command handler will be displayed as this is a default command. Right click on the Weekly tab to display the context menu and select the Monthly command handler.

     A list of all employees should be displayed.

11. Hold down the Control key and click on a number of employees in the Monthly list view.

     The Selected Employees form should be displayed and show the fullname of all currently selected employees in its list view.

12. Change the selected employees on the Monthly command handler and note that the Selected Employees viewer is dynamically refreshed.