Building a treeview in XOJO

I am new in XOJO. Our company would like to replace all we did in Access 2010 to a new Platform. We used to program treeview in Access and it is very simple.

I have tried to find examples for treeview on the internet for XOJO with no success.

I have tried to make it by myself but it seems it is not simple.

Anybody can give me the steps to make this?

I am building a web app that uses a treeview to implement the main app menu. I use Daniel Taylor’s web treeview. You can find it at http://webcustomcontrols.com/

Hope this helps.

LD

…and I forgot that there are treeview controls available from other third parties for desktop development. You can find one here: http://www.einhugur.com. I am quite sure that you will be able to find others.

LD

Hi Louis,
For WebCustom, it seems there is a licence to pay. I am not ready to pay this because the company didn’t make a decision yet about selecting XOJO as our main Platform.

I have already downloaded the TreeViewDemo from http://www.einhugur.com. ?I don’t know how to use it. There are many folders. Is there a way to import all this in a XOJO project?

You can create a hierarchical list using the ListBox to create something like this:

I’ll be covering this example app in the ListBox webinar on September 17th. Info here: http://www.xojo.com/support/webinar.php

Hi Paul,
Do you have the code from the example? Is it able to handle large folders?

I was able to create such a solution, its very slow on large folders. Is there a trick to get a better performance?

Thanks

The code is available on the webinar page and is also included in the Xojo 2013r3.1 examples:

Examples/Desktop/Controls/ListBoxExample

In a ListBox, the data in the folders of a hierarchical list are not preserved. So you have to look up the data each time the folder is expanded, which could slow down this process since file access is relatively slow. Alternatively, you could cache this data in your own data structures and redisplay it from there, but then you run the risk of being out-of-sync with the disk and you’ll use more memory.

I’m sure people can offer you performance tips if you can provide more details about what you are trying to accomplish.

Thanks Paul,

I’ll have a look at the example.
Yes as you said file access is relatively slow. That’s whats causing my solution being slow. We have a couple of large folders we need to publish to external parties, we don’t want to give them file access, instead we wanted to create our own solution just to guaranty that we have no gapes in our system.

I wonder if somebody has a great idea how to speed up the reading from the file system, in our case windows file system.

Thanks,

[quote=40475:@A Himmit]Thanks Paul,

I’ll have a look at the example.
Yes as you said file access is relatively slow. That’s whats causing my solution being slow. We have a couple of large folders we need to publish to external parties, we don’t want to give them file access, instead we wanted to create our own solution just to guaranty that we have no gapes in our system.

I wonder if somebody has a great idea how to speed up the reading from the file system, in our case windows file system.

Thanks,[/quote]

The Windows Functionality Suite has code using declares that can quickly get the files names of the files in a directory.

Somebody has written this comment “The Windows Functionality Suite has code using declares that can quickly get the files names of the files in a directory.”

Can I get an example code using the suggested functionality?

Thanks,

see:

http://forums.realsoftware.com/viewtopic.php?f=1&t=13692&st=0&sk=t&sd=a&hilit=folderItem+aaron&start=15

Hi Karen,

Thanks for the link. I have been trying to get Aaron’s example to work, but without success. This is because Aaron does not differentiate between the item read. I need to know whether an item is a directory or a file.
Do you by a chance know how to do that? or any one else has an idea?

Thanks

Once you have a folderItem, Folderitem.Directory will tell you if it is a folder

Thanks Karen,

I have tried that, but that does not work. It seems that the windows library used to read the folder don’t distinguish between the folder items. That’s why the property doesn’t work. Any ideas?

Thanks,

Any improvement or ideas here guys?

[quote=41609:@A Himmit]Thanks Karen,

I have tried that, but that does not work. [/quote]

Once you have a FOLDERITEM made from the file name, yes it does

Hi Karen,

I’m unsuccessful finding a proper solution. Could you please assist with an example?

[code] Dim f As FolderItem

f = GetFolderItem(SpecialFolder.Documents.NativePath)

If f.Directory Then
MsgBox “It’s a folder”
Else
MsgBox “It’s not a folder”
End If[/code]

Thanks Sascha,

I’m referring to the The Windows Functionality Suite from Aaron Ballman. See link below;
http://forums.realsoftware.com/viewtopic.php?f=1&t=13692&st=0&sk=t&sd=a&hilit=folderItem+aaron&start=15

My bad. I am mainly a Mac user :slight_smile: