The Treeview of the B4j is nice but lacks some style possibilities.
I took my B4A Treeview & Treenode class and adapted them for B4j to get these additions:
1. Text of the node can be in colors
2. Indent of the nodes is controlable
3. you can change the symbol for node opening and closing (not just a triangle).
4. Y position can be controlled, not only by the picture size
5. I couldn't implement the scroll by bars so I made it by dragging the mouse - more convenient.
6. In B4j Treeview you add a map if you need to put some data into a tag. Here there is a flexible Type which can hold all kinds of data items to pass to and from a node.
The class has two modules, TreePane and TreeNode, but the interface with the calling module is with TreePane only.
The Class is independent from the data items of the specific application, everything is defind in the calling module "GetData" and "NodeClicked" subs.
An example to the Data Type flexibility: In my Family tree application I pass the ID number and it is used to get the picture from a directory of pictures with the names of the files as Id & ".jpg"
In the attached example I changed it and pass the image itself in the Type.
The attached example has the two ways of treeview - the formal and the new class, with very simplified way of getting the data.
Edit: See post #8 for additional method, tree.OpenAllNodes.
I took my B4A Treeview & Treenode class and adapted them for B4j to get these additions:
1. Text of the node can be in colors
2. Indent of the nodes is controlable
3. you can change the symbol for node opening and closing (not just a triangle).
4. Y position can be controlled, not only by the picture size
5. I couldn't implement the scroll by bars so I made it by dragging the mouse - more convenient.
6. In B4j Treeview you add a map if you need to put some data into a tag. Here there is a flexible Type which can hold all kinds of data items to pass to and from a node.
The class has two modules, TreePane and TreeNode, but the interface with the calling module is with TreePane only.
The Class is independent from the data items of the specific application, everything is defind in the calling module "GetData" and "NodeClicked" subs.
An example to the Data Type flexibility: In my Family tree application I pass the ID number and it is used to get the picture from a directory of pictures with the names of the files as Id & ".jpg"
In the attached example I changed it and pass the image itself in the Type.
The attached example has the two ways of treeview - the formal and the new class, with very simplified way of getting the data.
Edit: See post #8 for additional method, tree.OpenAllNodes.
Attachments
Last edited: