Hi.
Firstly I am new to this so am sorry if im asking a question with a simple answer.
I have built my rtree within my project from a file system. Is there a way to dynamically update my tree ? i.e if I add another file into one of the folders can I get rtree to display the file without having to rebuild the tree ? I would assume you can write some code to do this on preopenstack ???
Any help would be appreciated
Thanks
Jimmy
update an rtree dynamically
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: update an rtree dynamically
Hi Jimmy!
No need to excuse yourself! Your question is highly valid!
Besides rebuilding the tree, there is no easy way to dynamically update (synchronize) rTree with changes in a file system. Problem is that you have to keep track of if a file or folder has been added or deleted and compare that with the rTree node data. This requires some way to have a unique identifier for every file/folder in your file system with the same identifier as a property of the corresponding node in your tree. One way forward here could be to use the creation time stamp of the files/folders in your file system as unique identifiers. From the time stamps you could then also check if a file/folder is newer than the latest node in your rTree. Depending on what synchronizing functionality you want, this becomes rather complicated though.
In most cases it is much easier and more reliable to rebuild the whole tree when changes to the file system has been made or as you suggests, when opening the app in an preOpenStack handler.
With my best regards
Mats
No need to excuse yourself! Your question is highly valid!
Besides rebuilding the tree, there is no easy way to dynamically update (synchronize) rTree with changes in a file system. Problem is that you have to keep track of if a file or folder has been added or deleted and compare that with the rTree node data. This requires some way to have a unique identifier for every file/folder in your file system with the same identifier as a property of the corresponding node in your tree. One way forward here could be to use the creation time stamp of the files/folders in your file system as unique identifiers. From the time stamps you could then also check if a file/folder is newer than the latest node in your rTree. Depending on what synchronizing functionality you want, this becomes rather complicated though.
In most cases it is much easier and more reliable to rebuild the whole tree when changes to the file system has been made or as you suggests, when opening the app in an preOpenStack handler.
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: update an rtree dynamically
Hi Mats.
Many thanks for your reply. I ended up rebuilding the whole tree. Just put the code on the preOpen Stack script so when I open the app it checks what is there and then renders the tree. I also added a refresh button to my app to re-render the tree on the push of a button.
Thanks again
Jimmy
Many thanks for your reply. I ended up rebuilding the whole tree. Just put the code on the preOpen Stack script so when I open the app it checks what is there and then renders the tree. I also added a refresh button to my app to re-render the tree on the push of a button.
Thanks again
Jimmy