examples on how to show volumes/folder structure in rTree
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 190
- Joined: Sat Apr 08, 2006 7:55 am
- Location: Lübbecke, Germany
- Contact:
examples on how to show volumes/folder structure in rTree
Hi,
are there any examples how to show volumes and folder structure in rTree
Regards,
Matthias
are there any examples how to show volumes and folder structure in rTree
Regards,
Matthias
Re: examples on how to show volumes/folder structure in rTree
Hi Matthias!
Use the sourcePath node property to "link" nodes to resources on a hard drive. You only need to set the sourcePath for the first node in a volume or folder! The rest is taken care of by rTree! Here comes an example on how to get the entire hard disk and other volumes into an rTree control:
Please let me know how it goes!
With my best regards,
Mats
Use the sourcePath node property to "link" nodes to resources on a hard drive. You only need to set the sourcePath for the first node in a volume or folder! The rest is taken care of by rTree! Here comes an example on how to get the entire hard disk and other volumes into an rTree control:
Code: Select all
on mouseUp
# Clear the tree from old data.
dispatch "delete_nodeData" to control "Tree"
# Create a node and set name and sourcePath for each volume.
repeat for each line tVolume in the volumes
dispatch "new_node" to control "Tree"
get the lastNodeID of control "Tree"
set the name_of_node_ID_[it] of control "Tree" to tVolume
set the sourcePath_of_node_ID_[it] of control "Tree" to tVolume
end repeat
dispatch "renderTree" to control "Tree"
end mouseUp
With my best regards,
Mats
http:www.tapirsoft.on-rev.com
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects
-
- VIP Livecode Opensource Backer
- Posts: 190
- Joined: Sat Apr 08, 2006 7:55 am
- Location: Lübbecke, Germany
- Contact:
Re: examples on how to show volumes/folder structure in rTree
Thanks so far. I will try and report.
Matthias
Matthias
Re: examples on how to show volumes/folder structure in rTree
Hi,
I found your post and example really helpful - can you point me in the right direction to amend this to show only the "My Documents" folder or specific path?
Thanks in advance!
I found your post and example really helpful - can you point me in the right direction to amend this to show only the "My Documents" folder or specific path?
Thanks in advance!
Re: examples on how to show volumes/folder structure in rTree
Hi hoburne!
To show only the "My Documents" folder you can use the specialFolderPath function. Please see LC dictionary for more info!
You can try the following:
To have a node show a specific path on your disks just set the sourcePath property of that node to the path. Like this:
Hope this is useful for you!
With my best regards
Mats
To show only the "My Documents" folder you can use the specialFolderPath function. Please see LC dictionary for more info!
You can try the following:
Code: Select all
on mouseUp
# Clear the tree from old data.
dispatch "delete_nodeData" to control "Tree"
# Create a node and set name and sourcePath.
dispatch "new_node" to control "Tree"
get the lastNodeID of control "Tree"
set the name_of_node_ID_[it] of control "Tree" to "My Documents"
set the sourcePath_of_node_ID_[it] of control "Tree" to specialFolderPath ("documents")
dispatch "renderTree" to control "Tree"
end mouseUp
Code: Select all
set the sourcePath_of_node_ID_[tNodeID] of control "Tree" to "C:/Users/MyName/MyFolder"
With my best regards
Mats
http:www.tapirsoft.on-rev.com
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects
Re: examples on how to show volumes/folder structure in rTree
Thanks Mats,
That works really well
Thanks.
That works really well
Thanks.
Re: examples on how to show volumes/folder structure in rTree
Morning,
Is there a way to pass the full system path of a file when you click on a node?
My rTree is displaying the Word documents (instruction sheets) inside a specified folder - this part works great. When you click a node the 'label' is passed to wordlib for displaying... also works (sort of!)
But I need to be able to have the full system path of the document associated to that node pass and not just the label - any ideas?
See attached image - might help explain better.
Thanks.
Is there a way to pass the full system path of a file when you click on a node?
My rTree is displaying the Word documents (instruction sheets) inside a specified folder - this part works great. When you click a node the 'label' is passed to wordlib for displaying... also works (sort of!)
But I need to be able to have the full system path of the document associated to that node pass and not just the label - any ideas?
See attached image - might help explain better.
Thanks.
- Attachments
-
- rTree view
- Capture.PNG (5.43 KiB) Viewed 20413 times
Re: examples on how to show volumes/folder structure in rTree
Hi hoburne!
I see you're making good use of rTree!
You can get the full system path for a node like this:
The sourcePath property of a node is set automatically by rTree if the node is showing a file or folder of your file system.
Please also check the sourcePath property in the rTree Workbench dictionary for more info and tips!
Please let me know if this was what you where looking for!
With my best regards
I see you're making good use of rTree!
You can get the full system path for a node like this:
Code: Select all
get the sourcePath_of_node_ID_[tNodeID] of control "Tree"
Please also check the sourcePath property in the rTree Workbench dictionary for more info and tips!
Please let me know if this was what you where looking for!
With my best regards
http:www.tapirsoft.on-rev.com
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects
Re: examples on how to show volumes/folder structure in rTree
Perfect - thanks. Although I couldn't find any info on sourcePath in the Workbench - got it to work.
Just need to get the top node to expand as it renders then its done.
I assume this looks correct:
Thanks again.
Just need to get the top node to expand as it renders then its done.
I assume this looks correct:
Code: Select all
set the expanded_of_node_ID_[1] of control "Tree 1318406276929" to true
Re: examples on how to show volumes/folder structure in rTree
Good to hear!
Your code is correct. Do not forget to render the tree after setting the expanded property!
Good luck with your project!
Mats
Your code is correct. Do not forget to render the tree after setting the expanded property!
Good luck with your project!
Mats
http:www.tapirsoft.on-rev.com
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects
Re: examples on how to show volumes/folder structure in rTree
hi again! Sorry to be a pain, i'm sure doing something wrong!
The tree is working perfectly, except I need to have the top level (node 1 as I understand it) expanded when it loads. So that I can see the Folder structure without any clicks...
Here's the code I am using:
note: commonPath is a link to a mapped network drive.
See the attached image. My tree seems to load with the top level expanded (showing minus sign) but doesnt load the rest of the structure?
Again, sorry if these are basic questions!
Thanks.
The tree is working perfectly, except I need to have the top level (node 1 as I understand it) expanded when it loads. So that I can see the Folder structure without any clicks...
Here's the code I am using:
Code: Select all
dispatch "delete_nodeData" to control "Tree 1318509484973"
dispatch "new_node" to control "Tree 1318509484973"
set the treeType of control "Tree 1318509484973" to "filesystem"
get the lastNodeID of control "Tree 1318509484973"
set the name_of_node_ID_[it] of control "Tree 1318509484973" to "Group Common Documents"
set the sourcePath_of_node_ID_[it] of control "Tree 1318509484973" to commonPath
set the expanded_of_node_ID_[1] of control "Tree 1318509484973" to true
dispatch "renderTree" to control "Tree 1318509484973"
See the attached image. My tree seems to load with the top level expanded (showing minus sign) but doesnt load the rest of the structure?
Again, sorry if these are basic questions!
Thanks.
- Attachments
-
- Capture2.PNG (7.75 KiB) Viewed 20396 times
Re: examples on how to show volumes/folder structure in rTree
Hi hoburne!
Ahh! I see! I have to admit that this is a scenario that I had not thought of!
However this is of course a thing that you should be able to do with rTree! I have therefor implemented a new command scan_node that will let you do what you are describing! The new command lets you scan a nodes corresponding file structure from for example the hard disk by script. Here is some example code:
I have uploaded a new version rTree Workbench 1.5.9 with the new feature and updated documentation. It is free for all 1.5 users. Please download from tapirsoft.com for now as there seems to be some problem in the RunRev store.
With my best regards
Mats
Ahh! I see! I have to admit that this is a scenario that I had not thought of!
However this is of course a thing that you should be able to do with rTree! I have therefor implemented a new command scan_node that will let you do what you are describing! The new command lets you scan a nodes corresponding file structure from for example the hard disk by script. Here is some example code:
Code: Select all
on mouseUp
# Clear the tree from old data.
dispatch "delete_nodeData" to control "Tree"
# Create a node and set name and sourcePath.
dispatch "new_node" to control "Tree"
get the lastNodeID of control "Tree"
set the name_of_node_ID_[it] of control "Tree" to "My Documents"
set the sourcePath_of_node_ID_[it] of control "Tree" to specialFolderPath ("documents")
send "scan_node_ID" && it to control "Tree"
set the expanded_of_node_ID_[it] of control "Tree" to true
dispatch "renderTree" to control "Tree"
end mouseUp
With my best regards
Mats
http:www.tapirsoft.on-rev.com
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects
Re: examples on how to show volumes/folder structure in rTree
Hi Mats,
That's it, works perfectly now. Also in this version I am able to see the instructions/command definitions on the left of the workbench stack.
Thanks again for all your help and a great tool.
Mike
That's it, works perfectly now. Also in this version I am able to see the instructions/command definitions on the left of the workbench stack.
Thanks again for all your help and a great tool.
Mike