Hierarchical Data, Recursion, Tree-Views, and a Custom Class to Assist

On the form popup, if I change the Level_ID, while the treeview value initially changes, when I hit the update levels button, it changes back. Example: Double click and edit a node. Change the value in Level_ID. Click OK. Then after it closes click the update Levels button. Might need a code step that does the refresh when the popup form closes. Otherwise, lock that field.
 
Stripping down the t_E2E, I figure, ID_type, Path and Level fields can be deleted without impact?
 
ID_type is yours, path was only to show how the recursion works, but I thought you wanted to show the level. You can also show that on the main form using the selected node level property or leave the buttons that can provide the details. However if it is L1.2.1.1 you know it is the 4th level.
f I change the Level_ID, while the treeview value initially changes, when I hit the update levels button
That is working as expected, because you are autoleveling. If your plan is to use the auto level then there is no need to have the level field editable. Except maybe if you add/move a couple of fields and you do not want to auto level which reloads the whole tree (if you had 1000s of nodes this could take time). You could give them the correct level so it is easier to read until you autolevel.
 
OK. We're going fast but this is going great. Thanks for your time.
 
We're going fast but this is going great
Yeah these are some really good ideas, but you asked for the more varsity level functions. Loading the tree is very simple tying back to the db is complicated. The move up down, the sort, and autlevel will be very useful. And now there is a full demo of add, edit, delete from either the tree to the table or from the table to the tree. I have never fully demonstrated that before.

I think only thing left is some icons. What is your plan for icons?
 
The pictures on my computer and are named with the following format "Primary Key . File Type" (e.g. 1.JPEG). The file path is dynamic...
"C:\Users\" & fOSUserName() & "\Pictures\AVC_Backend\E2E\" & [t_E2E]![E2E_ID] & ".png"

The code for FOSUserName() is at http://access.mvps.org/access/api/api0008.htm

The thought is, somehow provide a way to refresh the icons from the dynamic folder path. Since adding new nodes isn't likely to occur frequently, this could be an intentional click.

The reason I have a dynamic path is the database is distributed to multiple users and then download a picture library to their Picture folder on their own laptop. We might need a way to handle, if someone has the database but doesn't have the pictures, so the treeview still opens.
 
Icons and maybe a right click menu selection.

Yeah these are some really good ideas, but you asked for the more varsity level functions. Loading the tree is very simple tying back to the db is complicated. The move up down, the sort, and autlevel will be very useful. And now there is a full demo of add, edit, delete from either the tree to the table or from the table to the tree. I have never fully demonstrated that before.

I think only thing left is some icons. What is your plan for icons?
 
Those are great videos. I will tackle those. With the command bar, might get rid of the intermediate form.
 
Update 7
Added Right click function
1) Command bar when off node
2) Command bar when over node
Duplicates a lot of the other functions

Do you have any icons you want? THey should be 32X32 pixel BMPs. With Drag and drop it will be very hard to modify the images per level of node.
RightClick.jpg
 
Last edited:
I think as a demo lts good to show different options
I think this has about as many bells and whistles as I have seen on one treeview. Now need to add fancy colors and formatting.
 
And it's still less than a mega in size
It is just code so it does a lot but code does not take up much room.
 
What you screen captured and the version uploaded aren't in synch. I had a version 7 2 day's ago. Maybe version 8 needs to be loaded?

I've attached 10 .bmp files that have been named to match the primary key (e.g. 1.BMP). I'm tracking there are 22 records in the t_E2E table. There has to be a way to handle not having a picture for every node.

In a query, how do you extract the "Get Level" value for each record that you are able to obtain with the button click? I wish it was as easy as SelectedNodeLevel([E2E_ID]), but that didn't work.

Update 7
Added Right click function
1) Command bar when off node
2) Command bar when over node
Duplicates a lot of the other functions

Do you have any icons you want? THey should be 32X32 pixel BMPs. With Drag and drop it will be very hard to modify the images per level of node.View attachment 79467
 

Attachments

Try the download now. I must have zipped up the wrong file.
 
Right click on the tree is only giving me expand and collapse the tree. Is there a trick to showing the other options?
 
I see that it's all the way to the right when that function works. Is there a way to flip it so Expand tree is off the tree and the other functions are when you've made a specific node selection?
 
Edit node sees to always default back to the top record, regardless of the node you're on.
 
All of this works fine for me, it is as if your Hit/Test (determining if over a node) is not working. For me if I am over a node it gives the full menu. If not over the node gives the expand and contract. When I edit a node it is the proper node. Something is wacky on your end. What if you close and comeback. But if it is not finding the selected node then this will not work.
 

Users who are viewing this thread

Back
Top Bottom