Step 3. Add Pop-Up Menu to Show/Hide Columns - Optional
VFW062 – A Tree View with Columns
1. In the
view, drag and drop a onto the component
The
will be displayed at the top of the panel.Hint: Enter the menu item name and press to define the next menu item.
2. Define the
menu items as:
Address |
Zip Code |
Bus. Phone |
Start Date |
3. Select each menu item and set its True.
property to4. Add the following code to show and hide the tree view columns:
Evtroutine Handling(#MITM_1.Click)
If (#MITM_1.checked = true)
Set Com(#TVCL_3) Visible(false)
Set Com(#MITM_1) Checked(false)
Else
Set Com(#TVCL_3) Visible(true)
Set Com(#TVCL_3) Displayposition(3)
Set Com(#MITM_1) Checked(true)
Endif
Endroutine
Evtroutine Handling(#MITM_2.Click)
If (#MITM_2.checked = true)
Set Com(#TVCL_4) Visible(false)
Set Com(#MITM_2) Checked(false)
Else
Set Com(#TVCL_4) Visible(true)
Set Com(#TVCL_4) Displayposition(4)
Set Com(#MITM_2) Checked(true)
Endif
Endroutine
Evtroutine Handling(#MITM_3.Click)
If (#MITM_3.checked = true)
Set Com(#TVCL_5) Visible(false)
Set Com(#MITM_3) Checked(false)
Else
Set Com(#TVCL_5) Visible(true)
Set Com(#TVCL_5) Displayposition(5)
Set Com(#MITM_3) Checked(true)
Endif
Endroutine
Evtroutine Handling(#MITM_4.Click)
If (#MITM_4.checked = true)
Set Com(#TVCL_6) Visible(false)
Set Com(#MITM_4) Checked(false)
Else
Set Com(#TVCL_6) Visible(true)
Set Com(#TVCL_6) Displayposition(6)
Set Com(#MITM_4) Checked(true)
Endif
Endroutine
Note: In the above code, when a column is made visible the of that column is set back to its original value.
5. Compile and test your form. Using the right mouse menu on the tree view you should now be able to show or hide columns.
6. You have completed this exercise.