VFW062 Appendix A

VLF Windows Application Development

VFW062 - Appendix A

VFW062 – A Tree View with Columns

Source for the initial version of form iiiVFW11 - Tree View with Columns

Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientheight(499) Clientwidth(644) Height(533) Layoutmanager(#ATLM_1) Left(448) Top(208) Width(652)
Define_Com Class(#PRIM_ATLM) Name(#ATLM_1)
Define_Com Class(#PRIM_PANL) Name(#PANL_1) Displayposition(1) Height(42) Left(0) Parent(#COM_OWNER) Tabposition(1) Tabstop(False) Top(457) Width(644)
Define_Com Class(#PRIM_ATLI) Name(#ATLI_1) Attachment(Bottom) Manage(#PANL_1) Parent(#ATLM_1)
 
* A new property called Viewstyle has been added to the PRIM_TRVW
* Unlevelled means that that the tree no longer creates a level per field, and instead, creates a column per field.
* The developer is now reponsible for the level at which a tree item exists.
* This is governed by setting the PARENTITEM property of a tree item to another tree item
 
* NOTE - The tree can still be processed using SELECTLIST.
* Entries will be returned in the sequence they were added to the list. This may not reflect the order as seen in the tree
* To process in order sequence, use the FOR command
Define_Com Class(#PRIM_TRVW) Name(#Personnel) Columnbuttonheight(26) Componentversion(1) Displayposition(2) Dragcolumns(True) Height(457) Left(0) Parent(#COM_OWNER) Tabposition(2) Top(0) Viewstyle(UnLevelled) Width(644)
Define_Com Class(#PRIM_ATLI) Name(#ATLI_2) Attachment(Center) Manage(#Personnel) Parent(#ATLM_1)
Define_Com Class(#PRIM_TVCL) Name(#TVCL_1) Caption('Code') Captiontype(Caption) Displayposition(1) Level(1) Parent(#Personnel) Source(#STD_OBJ)
Define_Com Class(#PRIM_TVCL) Name(#TVCL_2) Caption('Description') Captiontype(Caption) Displayposition(2) Level(1) Parent(#Personnel) Source(#STD_DESC) Width(22)
 
Define_Com Class(#PRIM_PHBN) Name(#pb_load) Caption('Load Tree') Displayposition(1) Left(8) Parent(#PANL_1) Tabposition(1) Top(8)
Define_Com Class(#PRIM_TVCL) Name(#TVCL_3) Caption('Address') Captiontype(Caption) Displayposition(3) Level(1) Parent(#Personnel) Source(#STD_TEXTL)
Define_Com Class(#PRIM_TVCL) Name(#TVCL_4) Caption('Zip Code') Captiontype(Caption) Displayposition(4) Level(1) Parent(#Personnel) Source(#POSTCODE) Width(11) Widthtype(Characters)
Define_Com Class(#PRIM_TVCL) Name(#TVCL_5) Caption('Bus. Phone') Captiontype(Caption) Displayposition(5) Level(1) Parent(#Personnel) Source(#STD_DESCS) Width(21) Widthtype(Characters)
Define_Com Class(#PRIM_TVCL) Name(#TVCL_6) Caption('Start Date') Captiontype(Caption) Displayposition(6) Level(1) Parent(#Personnel) Source(#IIISTRDTE)
*
Group_By Name(#allfields) Fields(#std_obj #std_desc #std_textl #postcode #std_descs #iiiSTRDTE)
Group_By Name(#depnull) Fields(#std_textl #postcode #std_descs #iiiSTRDTE)
Override Field(#postcode) Edit_Code(D)
Evtroutine Handling(#pb_load.Click)
Clr_List Named(#Personnel)
Endroutine
Mthroutine Name(Add_entry) Access(*private)
Define_Map For(*input) Class(#std_obj) Name(#i_code)
Define_Map For(*input) Class(#std_Desc) Name(#i_Description)
Define_Map For(*input) Class(#prim_tvit) Name(#i_Parent_item) Mandatory(*null) Pass(*by_reference)
Define_Map For(*output) Class(#prim_tvit) Name(#o_Tree_item) Mandatory(*null) Pass(*by_reference)
Define_Map For(*input) Class(#std_code) Name(#i_type)
Define_Map For(*input) Class(#std_textl) Name(#i_addr)
Define_Map For(*input) Class(#postcode) Name(#i_zip)
Define_Map For(*input) Class(#std_descs) Name(#i_phone)
Define_Map For(*input) Class(#iiiSTRDTE) Name(#i_date)
#allfields := *null
* The same fields are used regardless of the "level" of the tree item
#std_obj := #i_code
#std_desc := #i_Description
#std_textl := #i_addr
#postcode := #i_zip
#std_descs := #i_phone
#iiiSTRDTE := #i_date
Add_Entry To_List(#Personnel)
* Set the new tree item's parent to the supplied parent. A null parent means that the item will appear as a root node
* The parent is no longer governed by the data. It is a choice the developer can now make.
* Effectively, there is NO LIMIT to the number of levels.
* Note: The parent of a tree item is completely dynamic. It can be set at any time
Set Com(#Personnel.currentitem) Parentitem(#i_Parent_item)
* Set required image for each level
Case (#i_type)
When ('= DEP')
Set Com(#Personnel.currentItem) Image(#vi_deptcl)
When ('= SEC')
Set Com(#Personnel.currentItem) Image(#vi_sectcl)
When ('= EMP')
Set Com(#Personnel.currentItem) Image(#vi_employ)
Endcase
* Return the tree item for use as a parent
Set_Ref Com(#o_Tree_item) To(#Personnel.currentitem)
Endroutine
End_Com