Step 1 Create Form iiiVFW11 Tree View with Columns

VLF Windows Application Development

Step 1. Create Form iiiVFW11 - Tree View with Columns

VFW062 – A Tree View with Columns

1.  Define a new field in the repository iiiSTRDTE – Start Date based on STD_OBJ. This is a character field to be used as the date column in the tree view.

2.  Create an initial version of your form.

     Name: iiiVFW11

     Description: Tree View with Columns.

     Replace the form's code with the source from VFW062 - Appendix A .

     Change references to iiiSTRDTE to use your initials.

     Ignore other errors at this stage, you will add the missing code.

3.  Review the form in the Design view and note the following:

  • The Tree View has a ViewStyle property of Unlevelled.
  • Most of the tree view columns are based on standard fields such as STD_OBJ rather than fields from the files which will be used to populate the columns. This is because the column data must be set up as required for each level.
  • All the columns are at Level 1.
  • Drag Columns is enabled. This means that the user will be able to drag and reposition the columns.

4.  Review the source code that has been provided. If you are not familiar with a program, you should always use the GoTo tab to quickly understand what routines it includes.

  • When the Add_Entry method is invoked it is passed the variables to populate the tree level being filled.
  • After adding an entry to the tree view (Name = Personnel), the parent item is set for the new row in the line:

 Set Com(#Personnel.currentitem) Parentitem(#i_Parent_item)

 

  • An appropriate icon is added, depending on the level being populated.
  • The PB_LOAD push button Click event in the supplied code simply clears the tree.