wxDirTraverser Issues
Posted: Sat Oct 10, 2009 8:48 pm
I currently have a wxDirTraverser that searches a client's specified folder for a list of matching files for his use. However, if the client should realize that he has typed in the wrong criterion, and is searching, say, the entire C: drive, I would like for him to be able to stop searching.
So, using Yield() and setting up a Stop button, I set a class variable called "m_TerminateSearch" to true. If the Traverser detects that this is true, it returns wxDIR_STOP using this code:
However, when I hit the Stop button (or set m_TerminateSearch to true in any way), the application freezes for a short while as if it's traversing the rest of the directory anyway. (A quick test confirms that indeed, it does go through the rest of the files anyway.)
How can I force the Traverser to actually STOP searching?
So, using Yield() and setting up a Stop button, I set a class variable called "m_TerminateSearch" to true. If the Traverser detects that this is true, it returns wxDIR_STOP using this code:
Code: Select all
if (wxGetApp().m_TerminateSearch) {
wxGetApp().Yield();
return wxDIR_STOP;
}
How can I force the Traverser to actually STOP searching?