Hi, I’m using a command from MBS to calculateDirectorySize in a thread, but I always get a warning in my app that this is not legal to alter the main interface from a thread but where do I alter it ? here is my threadcode in the run.
Dim f2 as folderItem
f2 = app.gDragger.FolderItem // app.gDragger is a global property of a dragitem which is a folderItem, tried to move it to app, but no help.
dim d as DirectorySizeMBS
d = f2.CalculateDirectorySizeMBS(True,0)
app. gSizeNo = d.LogicalTotalSize/1000000000
So now I run a timer to check if the thread is done, and that one is supposed to check the gSizeNo (a global property) .
But, both of these are at app level and not at window1 level. So not in the mainGUI ?
I can’t see how this code is trying to manipulate UI element .[/quote]
Accessing a DragItem from a thread will raise a ThreadAccessingUIException. While only a Xojo engineer can say for certain, I’d conjecture that the DragItem class is explicitly checking whether it’s running on the main/GUI thread and raising an exception if not.
Thanks Andrew, that solved it. Now I just used a string for nativepath, and lower the ticks in the MBS command to 3. Now it worked.
Now I can even run sliders up and down, while the command is calculating all foldersizes on my disc.