Low Level Direct Access to the Visualization Trees
In VLF-WIN code you can directly access the VL trees (class #PRIM_TRVW) that are used to visualize the instance list content.
There may be two trees – the primary tree and possibly a secondary tree when side-by-side or over-under displays are used.
Once you have a reference to the tree you can access the items with in the tree and the columns within the items.
The properties #avListManager.avPrimaryTree and #avListManager.avSecondaryTree yield references to the primary and secondary VL trees used to visualize an instance list.
Some significant usage points:
- The trees are the visualizations of an instance list. They are not the instance list itself. If you change the way that an instance list has been visualized, you are not changing the instance list.
- Do not save tree or tree item references in your code. This would probably cause resource leakage or other problems.
- Do not change tree or tree items selection or focus. Update the instance list instead.
- Do not change tree or tree items inside beginlistupdate/endlistupdate code blocks.
- The tree references are not applicable if you are using your own snap-in instance list browser.
- Use caution with your changes and test carefully how they interact with the rest of the Framework.
- VL tree level programming skills are assumed.
Some examples:
Get the number of entries in primary visualization tree
#Std_text := #AVLISTMANAGER.avPrimaryTree.Entries.AsString
Use MESSAGE_BOX_SHOW With_Args(ok ok info *COMPONENT ('Tree has ' + #Std_text + ' entries'))
Change the icon associated with every entry at level 1 in a tree
For Each(#TreeItem) In(#avListManager.avPrimaryTree.Items)
#TreeItem.Image <= #vf_ic004
Endfor
Note: This example is iterating over the tree so it is working in the visual order of the currently displayed tree - not necessarily the order of the instance list entries.
Make sure the first entry in the tree is visible
#avListManager.avPrimaryTree.Items<1>.EnsureVisible := True
Note: This example does not cater for an empty tree.