Step 2 Create Reusable Part Section Employees

VLF Windows Application Development

Step 2. Create Reusable Part Section Employees

VFW112 – Drag and Drop between Components

This component will be displayed on the right hand side of the Transfer command handler. It displays the employees belonging to the section selected in the instance list. The drag and drop operation allows an employee(s) to be transferred to the Section from another section. A Save button enables the changes to be saved to the file SECTAB.

1.  Create a new Reusable Part / Panel:

     Name: iiiVFW37

     Description: Section Employees.

2.  On the Design tab, use New Layout to give iiiVFW37 an Attachment manager.

3.  Drag and drop a List View component to the center of the Panel. Change the List View Name to DRAG_TO.

4.  Add fields DEPTMENT, SECTION, EMPNO, FULLNAME and STD_CODEL to the List View DRAG_TO.

5.  Make the STD_CODEL column Visible, False.

6.  Change the list view column headings to suitable short values. For example: Dept., Sect., Emp No. and Full Name. Change each column's CaptionType to Caption.

     Change the Full Name column's WidthType = Remainder.

7.  Save the reusable part.

8.  The Section Employees component is not a command handler, and therefore cannot communicate directly with the Framework. The Transfer Employee command handler (which you will create in the next step) will retrieve department and section codes for the current instance list entry.It will then set properties in iiiVFW37 to enable this component to populate the DRAG_TO list view with employees for the current instance list entry.

a.  Define the following properties in iiiVFW37:

Define_Pty Name(uDepartment) Set(*auto #deptment)
Define_Pty Name(uSection) Set(BuildList)

 

b.  Create a property routine BuildList, to clear and populate the DRAG_TO list with employees.

     Your code should look like the following:

Ptyroutine Name(BuildList)
Define_Map For(*input) Class(#section) Name(#i_section)
#std_codel := *blanks
Clr_List Named(#DRAG_TO)
Select Fields(#deptment #section #empno #surname #givename) From_File(pslmst1) With_Key(#deptment #i_section)
#fullname := #surname + ', ' + #givename
Add_Entry To_List(#DRAG_TO)
Endselect
Endroutine

 

c.  Review the BuildList property routine.

     Section code (SECTION) is passed into this routine as i_section.

     The STD_CODEL column is set to blanks. Entries with a blank STD_CODEL will be recognized as existing employees for the section.

     The list DRAG_TO is cleared and populated with all employees for the department, section using logical file PSLMST1.

9.  Compile iiiVFW37 in its current form and leave it open in the editor. You will add additional logic for drag and drop in a later step.