Can someone point to the latest database with the latest features mentioned in this thread? There seems to be a lot of conversation and additional code, but I haven't found the authoritative file with latest info.
MajP, you've done a lot of great work on this !!
The three files at the beginning should now all be current. V18 is the complete demo with various methods of loading. This includes a single recursive table, a union table of non recursive data, a light load, and the full demo employing drag drop and loading images on the fly. I saw that the JKP MS Forms demo was called light load, but that was incorrect. I am working that now with @Pac-Man.
I'm new here, first I would like to thank you for this important contribution that helped me alot,
I'm working on an old data form that fetch its categorization entries from 3 or more levels from a nested table that is being edited and managed by an old form .mdb, I used to use treeview control with much of vb6 coding , that I was not able to maintain for long time ,
but now I see your solution is nearly giving me all what I need to reuse the old data structure,
I just had 2 issues ,
am writing node description in Arabic , while all Arabic characters are already working file in access components , but it gives me ??? and rubbish characters inside the ttreeview control itself , I didn't find a solution for this online.
The second issue :
Is it possible to guide me on how to simply link the form to my nested table , that contains ID , patent ID , Node description.
What should the level mean in your tree table?! Is it something that I should insert while editing?! Or is it something that is already being generated by code from your program!
am writing node description in Arabic , while all Arabic characters are already working file in access components , but it gives me ??? and rubbish characters inside the ttreeview control itself , I didn't find a solution for this online.
The way I tried to make this work for everyone so they do not have to write specific code is building a standard query. If you can build the query you can instantiate and load the treeview in a single line of code.
Need to make a query with Fields Aliased to these names: •Identifier – Something that tells which table the record is from so if it comes from a Union query. This can be the name of the table.
Important with organized data coming from two tables (EMP10 and CUST10) •ID – Concatenate an Identifier with the actual PK •ParentID – Concatenate the parent Identifier with the parent PK •NodeText – What you want to display. Often concatenated data •Image – Optional if using an icon. This is the key used by the Imagelist
I use something called "Identifier" which is needed if the query uses a Union query. It is not really used if the table is self referencing, but required any ways.
If your query is based on a single table that is selfrefencing you can pick anything. If it is based on a union query I would pick the table name for each of the seperate queries that you union together.
Lets assume your table is about employees you could pick something like "emp" as your identifier. Any string would work.
Then you make your query like
SQL:
SELECT "emp"
AS
Identifier,
"emp" & [ID]
AS ID,
"emp" & [Parent ID]
AS ParentID,
NodeDescription as
NodeText
FROM employees
ORDER BY [emp] & [ID];
In this example if your table has no parent for your top most base nodes, then you initialize like this.
I never name my ID fields "ID" in my tables. So I am not sure if you will run into a problem when trying to alias the ID to ID. I recommend changing the name of the ID field in your table to something more descriptive.
If you can send your table or a small sample of it I can quickly test it and see if I can make it display. I can also show how to load. It is as simple as building the query correctly.
I discuss a second treeview control using MSFORMS controls. I can see if that will display arabic.
I wonder if this treeview would be able to function like the one at itemgenie. This is one of the better implementations of a home inventory database online that I have seen and after testing it out, it makes me want to re-create it in Access. They allow 100 items to be entered on a free account, so that was good enough for test driving it. Not sure it is possible in Access though. Maybe through the browser control.
Yes. I believe I demonstrated all of that functionality except for the ability to define unique properties for each item type. Which is more a database question than a tree view question. I guess you could do this with an entity value attribute model. Then you can define you fields and add custom fields.
This is what I'm hoping for. There is a nice visual cue of the levels in what looks like a simple dropdown, but I'm not sure how it all works yet. The drop down shows the parent > child > child > etc... instead of the regular tree view. There are just nice visual touches with the way the whole thing operates. It might be java script or something native to html, I haven't torn into it yet. I did a lot of general website design work recently just to get up to speed on things as they are today and it blows me away what some simple css code can do these days.
Not sure if you looked closely at Adding an item, but it's great that you can select a location from the tree view (essentially highlighting it) and then click the add new item button and that exact location is pulled into the form automatically. Here is a screen shot of the Add New webform. I also really like the idea of clicking outside of the form simply closes the popup form. Also the effect of displaying the field name inside the field when there is no value and then it transitions to the perimeter as shown in the example form is pretty impressive. You can either drag the item to a different location or use the dropdown in the update form.
I guess I'll just dig in and see what I can come up with. I noticed the demo of the tree view doesn't actually update the data in the tables. What's the preferred method to do that? Just using an update query or running through a record set based on the query?
Not sure if you looked closely at Adding an item, but it's great that you can select a location from the tree view (essentially highlighting it) and then click the add new item button and that exact location is pulled into the form automatically
If you look at the E2E demo it does that. Although I see I need to put in a fix.
If you right click on a node you can select to add a child node
You can add a new item at the location.
That bring up the pop up to add a new record.
I did see that it is broken in the demo. It keeps adding it as a root node and not in the correct location. So it can be done, but I need to fix.
IMO that web form looks unusable for anything but a very trivial tree. I have trees with 1000s of node. From that image it looks as if you would have to expand the whole tree and scroll. That really defeats any benefit of a tree where you can collapse and expand the nodes to find what you want. Maybe there is more to it.
Instead of a Pop up you can have a subform on the main form that lets you view/edit a selected node.
MajP, I must have looked at a different demo or didn't realize it had that functionality. I'll look at the one you mentioned. The one I looked at was actually from another thread from PacMan and assumed it was the same one here. All of the tree view stuff is new to me because I didn't need that functionality in the past, but now I'm interested. That other thread had to do with lazy loading the nodes, and you seemed to have solved that issue.
It is buried in the demo on this thread. I think there are a couple of other examples I demo adding, editing, and deleting nodes.
The presentation I did here demos these functions starting around 20:00 min
The next Access Europe User Group meeting will be on Wednesday 7 Aug 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome Pete Poppe who is very well known to Access World Forum members as MajP In this session, Pete will...
You could replicate that location combo box that you show, I I do that using a listbox in this thread, but could be a combobox. It shows the Current and Archived Hierrarchical orgainization
Good to finally get some idea of what the business process actually is. Reward seems a bit upside down - those doing most of the work get least reward. And no chance of promotion since you said movements don’t happen still confused about when someone leaves since when someone joins, the...
www.access-programmers.co.uk
This shows the technique to do that by saving a "tree" sort order. Unfortunately combos tend to strip out leading spaces so I use ---- instead. In that image in the lower corner is a listbox acting like an expanded tree.
@Mike Krailo Started to play with it and I think you can do some pretty nice things with this.
The dynamic fields are doable, but for demo purposes I will pick generic fields. You can see those in the second image.
With the tree view you can add icons. I started with a Room (a door), Bag, Box, Generic Location icons. And one icon for the items which is just an "i".
When you navigate to a location the subform shows you everything in that location.
If you navigate to an item it shows you the item details where you can edit an item.
You will be able to eventually add items under any location. Drag and drop already works so you can move a box to a different room. You will have the right click features I demoed.
I can replicate the "Location" combo box, but unlikely to ever want to do it that way. Just right click a location and add a new item or new sub location.
It's amazing how many different ways there are do this. With your example, the item names and icon are displayed in the tree view instead of separating the items out like they did with item genie app. You're way is arguably better and I assume the details at a location is a popup that activated from the right click menu. Edit: I see the details are just inside a tabbed page.
I can replicate the "Location" combo box, but unlikely to ever want to do it that way. Just right click a location and add a new item or new sub location.
I would only do icons for the different types of locations (Room, Box, Bag, etc) not for each type of item. Locations would be relatively small. You could do that for different item types and build the GUI to allow you to find and add all those icons, but that would require a lot of work to gather up all the icons. You can have the actual image. The icons have to be real simple to be readable.
I'm trying to change the icons. Is there any limitations on file types? I see in your presentation you described using the Image List control and assigning the key values to each image, but I'm not seeing how you are actually assigning them from the form as a user. If I add a root node or any other kind of node, is there an easy way to load a custom icon to for the new node?
I looked at the code for the loadImageList and see that it loops through the existing bit map images in the folder but that doesn't explain how each image gets assigned to a particular node. I see how the add command works to load an image based on the key value, I just don't see how the user does this from the interface. I see the LoadPicture function loads the named picture into the control
I see in your class module where you noted the optional image in the query, but I'm not seeing that at all in your demo anywhere to create the images seen in the tree view. Maybe I'm blind.
Also, I'm assuming there are two tables in use. One for Location and one for Items and then you concatenate the two tables to get that combined view in one tree view. I'm still trying to figure out how that is setup. It almost makes sense.
I believe Icons have to be bitmaps. So I always do that.
You need to add an imagelist to the form. Then add the icons to the image list. I actually do this in code, but you can do it manually You may have to double click on the image list. Give each icon a Key.
Then you have to tell the treeview what imagelist to use. Do this in the treeview properties. I tried do this in code and always got an error.
Once you do that then you simply pass the Key of the image in the node add method. It is the fifth argument. So if the key is "Box" you simply pass "Box". You already related the imagelist to the treeview.
Of you can create a node and then simply set the image property like
MyNode.Image = "Box"
I think the confusion was how you were doing it in code in your demo. I think I see now how you set the the key value in the qryNodeE2E. I was looking at the wrong queries and didn't understand how you assigned the key name. Just add the extra fields in the query as needed. The next thing is to set the size of the icon to a larger size. I'll see if I can get the 48x48 size icon to work and use a bigger font in the tree.