Yet another "doevents" question - recursive task
My app should scan recursively all the directories on a hard disk.
For each file in a directory: do something (e.g: save names, date & size of all files)
for each sub-directory: do it all over again.....
Show a tree of all directories
I have the logic; the sub to scan 1 directory (given it's full path and the "branch" of the tree it is on) is as follows:
Find all "files",
if a file - do what needed
if a directory - call the sub again with a new child "branch" and augmented path
The problem is that during the scan, the prog seems to "freeze":
I want to show the progress of the scan by displaying the current path on a label and also show a progressbar.
but since the prog is still processing the disk, no updating is done.
Using a timer seemed to present itself as the solution, BUT...
The problem is that the parameters for the sub (branch,path) are generated within the sub itself on a "higher level"
so "quitting" the sub in order to wait for the timer to tick will lose the parms.
Any idea on how to be able to update the GUI while the scan is on?
My app should scan recursively all the directories on a hard disk.
For each file in a directory: do something (e.g: save names, date & size of all files)
for each sub-directory: do it all over again.....
Show a tree of all directories
I have the logic; the sub to scan 1 directory (given it's full path and the "branch" of the tree it is on) is as follows:
Find all "files",
if a file - do what needed
if a directory - call the sub again with a new child "branch" and augmented path
The problem is that during the scan, the prog seems to "freeze":
I want to show the progress of the scan by displaying the current path on a label and also show a progressbar.
but since the prog is still processing the disk, no updating is done.
Using a timer seemed to present itself as the solution, BUT...
The problem is that the parameters for the sub (branch,path) are generated within the sub itself on a "higher level"
so "quitting" the sub in order to wait for the timer to tick will lose the parms.
Any idea on how to be able to update the GUI while the scan is on?