View Full Version : Nodes

19-05-2013, 17:42
I have not found any Nodes yet- so I made my own.

This example consists of two files, put them both to same folder and run NodeTest which is a simple file-explorer written in TBGL+FILE that has a treeview to display my computer and below noded volumes and folders and a simple list to display the files.

Main attention should be on the Nodes-Unit which handles tree & relations of nodes while the NodeTest.tBasic is just one of possible uses for nodes. It would be great to have this improved in speed & fuctionality - there are not all functions fully tested yet ;)

Perhaps some ideas to this,:anyone:

Minversion (or when did Array Scan the improve?)
Edit: Added NODE_SetBranch(Index, Flag)-Function to set a whole branch of tree to either %NODE_COLLAPSED or %NODE_EXPANDED
- not recommended to use expand on a whole tree before it is completely filled with data - leads to uncomfortable behaviour since the nodes don't know yet if they are expandable...

20-05-2013, 18:17
Here's another example for using Nodes. This time it's just two trees - you can choose to attach "random" nodes as sibling or child to any node of whichever tree you want. Just click one of those Buttons... The function which does the important stuff is CTRL_Button_Click().

You'll need the Nodes.tBasicU from the post above placed next to this file.

Also Minversion

Edit: last change was just some scroll-behaviour - so if user adds more ctrl's the top position was not calculated right when clicking on it ;)

Petr Schreiber
20-05-2013, 18:40
:drink: Good examples on topic which is general purpose enough that it should be checked out by every ThinBASIC programmer!

Rene introduces concept of nodes and demonstrates it on use with File and TBGL module - but that is not the only area where it could be used.


21-05-2013, 20:46
very, very, very self-explaining...

This time shows the use of Nodes in combination with Dictionary-Module as usual help-files would work and explains the use of Nodes-Unit which you'll need in addition to this on the same path.
("Nodes.tBasicU"-attachement is the same as above)
Also Minversion required.

23-06-2013, 06:23
Just to inform:

Since Dir_ListArray now works correctly since tB-version, the first example will work correct for you now if you don't save it to some folder which has any subfolders inside...

I was not aware of this when I published it - since I had the script saved to some folder with some subfolder inside and I did not know that it did not work. So a few of you might have thought the script is buggy and never had a closer look.

And since I already made a post, attached some sound-browser which allows to browse folders with sound-files inside. I made it since I did not like to start some different program or instance of some sound-editing/playing-software just to find a fitting sound for whatever. So on the left side there's the usual treeview, on the right you have the file-list - and if there's a soundfile (whichever TBASS-module accepts "MP3", "MP2", "MP1", "OGG", "WAV", "AIFF") you can click it and listen.

When I made this I found out that Dir_ListArray did not work correctly - but it was a hard, long, enervating way to find the reason why my "C:"-drive did not show up in the tree :D