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
:iiiVFW37
Section Employees.
2. On the
tab, use to give iiiVFW37 an .3. Drag and drop a List View component to the center of the Panel. Change the List View DRAG_TO.
e to4. Add fields DEPTMENT, SECTION, EMPNO, FULLNAME and STD_CODEL to the List View DRAG_TO.
5. Make the STD_CODEL column 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 Caption.
toChange the Full Name column's 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
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
, 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
.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.