Step 4 Complete Command Handler to use Department Dropdown

VLF Windows Application Development

Step 4. Complete Command Handler to use Department Dropdown

VFW072 – Create a Department Dropdown Reusable Part

In this step you will add code to the Employee Details command handler, to interact with the Department Dropdown component.

Your command handler is a maintenance function. This means:

1.  When the employee data is read, it needs to tell the department dropdown to position to the current employee's department. Change the uExecute method routine to set the uCurrDepartment in the department dropdown component to DEPTMENT.

     Your code should look like the following. Changes are shown in red.

. . . . 
Fetch Fields(#XG_HEAD) From_File(PSLMST) With_Key(#EMPNO)
*  ??? Addition logic may be required here ???
#IIIVFW13.ucurrDepartment := #deptment

 

2.  When the department dropdown component signals that department has changed, the command handler should get the current department code value from the department dropdown.

3.  Add an event handling routine for iiiVFW13.uCurrDepartment. Your code should look like the following:

Evtroutine Handling(#IIIVFW13.UDepartmentChanged)
#deptment := #IIIVFW13.uCurrDepartment
Endroutine
 

     Hint: To create the event handling routine, on the Design tab, select the department dropdown and use the context menu to select Events: IIIVFW13 / uDepartmentChanged Event

4.  Compile the Employee Details command handler, iiiVFW06.

5.  Execute the Framework as an End User. Use the By Location filter to populate the instance list and check that the department dropdown displays the correct value.

6.  Change the department for an employee and Save the change. You may find that the change is invalid because the section code is no longer valid. You will address this issue in the next exercise.