Step 1 Create Sorted Command Handler

VLF Windows Application Development

Step 1. Create Sorted Command Handler

VFW056 – Process a List in Sorted Order

1.  Create a new reusable part:

     Name: iiiVFW09

     Description: Loaded or Sorted List Items

2.  Change the component's Ancestor to VF_AC010.

3.  Select the Design ribbon and give the reusable part an Attachment manager.

4.  Drop a panel onto the bottom and changes its name to BUTTON_PANL

5.  Drop a Panel onto the centre and change its name to MAIN_PANL.

     If necessary, select IIIVFW09 in the Layout Helper tab and ensure the Child Details are correctly defined.

6.   Select the MAIN_PANL. On the Design ribbon, select Split Vertical on the New Layout menu to give the panel a Vertical Split layout manager.

7.  Use the Layout Helper /Layout Manager Details / Category / Divider Style  to change the Divider Style to Raised.

     The Vertical Splitter creates two new panels. Rename these as MAIN_LEFT and MAIN_RIGHT as follows:

8.  Select panel MAIN_LEFT, and on the Layout Helper tab give it an attachment manager of ATLM_1. Do this by selecting the attachment manager ATLM_1 in the Layout dropdown.

9.  Give the MAIN_RIGHT panel the ATLM_1 attachment manager.

10. Drop a list view into the center of MAIN_LEFT and rename the list view LIST_1.

11. Drop a list view into the center of the MAIN_RIGHT panel and rename the list view LIST_2.

12. Save your changes.

13. Select the file PSLMST on the Repository tab and drag fields EMPNO, SURNAME, GIVENAME, DEPTMENT and SECTION into each list view. In a real application you would spend some time making the column headings suitable.

14. Select list view LIST_1 and select each column. Do this by clicking on each column heading and changing the column's SortOnClick property to True.

15. Create an Initialize event routine for LIST_1 and add code to populate it with all records from the file PSLMST. Your code should look like the following:

Evtroutine Handling(#LIST_1.Initialize) Options(*NOCLEARMESSAGES *NOCLEARERRORS)
Clr_List Named(#LIST_1)
Select Fields(#LIST_1) From_File(pslmst)
Add_Entry To_List(#LIST_1)
Endselect
Endroutine

 

16. In the Layout Helper, select the BUTTON_PANL and give it a Flow Across manager. On the Layout Manager Details tab, select Margins and use the All setting to set all Margins to 6 pixels.

17. Add a push button to the BUTTON_PANL and change its name to PHBN_LOADED.

a.  Change its Caption to Loaded Order.

b.  Create a Click event routine.

18. Add a second push button to the BUTTON_PANL.  

a.  Change its Name to PHBN_SORTED.

b.  Change its Caption to Sorted Order

c.  Create a Click event routine.

19. Save your changes.