Hierarchical Data, Recursion, Tree-View, and a another Great Custom Class (1 Viewer)

dgreen

Member
Local time
Today, 04:05
Joined
Sep 30, 2018
Messages
397
Another improvement request, which would have been part of your normal process.....
- Right click on a node value and it takes you to a filtered form.
- Right click and get a filtered report.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:05
Joined
May 21, 2018
Messages
4,493
I do not think you can trap a right click.
As I said, my simple preferred approach is to have a double click event that pops open an intermediate menu form. You would pass this form the Primary key in openargs. On this form you have choices to open other forms and reports based on the node clicked and the choice made.
Edit, Delete, Add at Current Location, Add Root Level, View Report for This Node .....
Make a selection and it passes the PK again to the next form or report.
Is the filter just on a PK or what kind of filter?
I can demo popping up this intermediate form, and after that it is just basic Access that you can code.
I see to be able to sort with no problem no, but in a different version of the db. I have to see what is going on with the most recent version.
 

dgreen

Member
Local time
Today, 04:05
Joined
Sep 30, 2018
Messages
397

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:05
Joined
May 21, 2018
Messages
4,493
So would this code not be able to provide that custom right click (e.g. shortcut menu)?
That code is in .net and not vba. I do not know if something like that exists in vba.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:05
Joined
May 21, 2018
Messages
4,493
Interesting, ties into some discussions on command bars. Those are pretty good tricks. I will show you the intermediary and you can decide if write click is still desired. I will give it a try just to learn it.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:05
Joined
May 21, 2018
Messages
4,493
Update.
Double click
1) Add new child node
2)Add root node (under construction)
3)Edit current Node
4)Delete current node
5) the autolevel and sort should work on form close.

I had to go back to my version to get it working. When I get time I will give you a stripped version and the filter combo back. Eventually need to organize this code and put in detailed instructions. Some of these things are pretty complicated to see how the pieces come together.
 

Attachments

  • MajP TreeviewDemo V7.zip
    169.2 KB · Views: 32

dgreen

Member
Local time
Today, 04:05
Joined
Sep 30, 2018
Messages
397
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.
 

dgreen

Member
Local time
Today, 04:05
Joined
Sep 30, 2018
Messages
397
Stripping down the t_E2E, I figure, ID_type, Path and Level fields can be deleted without impact?
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:05
Joined
May 21, 2018
Messages
4,493
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.
 

dgreen

Member
Local time
Today, 04:05
Joined
Sep 30, 2018
Messages
397
OK. We're going fast but this is going great. Thanks for your time.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:05
Joined
May 21, 2018
Messages
4,493
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?
 

dgreen

Member
Local time
Today, 04:05
Joined
Sep 30, 2018
Messages
397
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.
 

dgreen

Member
Local time
Today, 04:05
Joined
Sep 30, 2018
Messages
397
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?
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:05
Joined
May 21, 2018
Messages
4,493
Those are great videos. I will tackle those. With the command bar, might get rid of the intermediate form.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:05
Joined
May 21, 2018
Messages
4,493
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
 

Attachments

  • MajP TreeviewDemo V8.zip
    192.6 KB · Views: 32
Last edited:

dgreen

Member
Local time
Today, 04:05
Joined
Sep 30, 2018
Messages
397
I think as a demo lts good to show different options.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 05:05
Joined
May 21, 2018
Messages
4,493
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.
 

Users who are viewing this thread

Top Bottom