has something changed recently with the exitModalState function? It has worked fine for me on Mac and Windows, but after an update to the tip last night it seems that it doesn’t work anymore on Mac. Windows has no problems.
I just put a Component in a modal state and have some thread try to get it out of the modal state with exitModalState after it has finished.
setprogress with a ThreadWithProgressWindow also stopped working for me on a Mac, it doesn’t update. However, the Juce demo works perfect, so it must be something that I have to change because of a change in Juce?
I did some research and found the following, also true for your demo:
when I run a ThreadWithProgress Window from a menu perform function, it doesn’t get updated. Running the same code from for example the buttonclicked method works fine. This is only the case for Mac, Windows is ok here. I don’t know if my original exitModalState problem has something to do with this, but it seems that there is something going on with threading in Mac? It used to run fine here.
[code]//==============================================================================
class DemoBackgroundThread : public ThreadWithProgressWindow
{
public:
DemoBackgroundThread()
: ThreadWithProgressWindow (T(“busy doing some important things…”),
true,
true)
{
setStatusMessage (T(“Getting ready…”));
}
~DemoBackgroundThread()
{
}
void run()
{
setProgress (-1.0); // setting a value beyond the range 0 -> 1 will show a spinning bar..
setStatusMessage (T("Preparing to do some stuff..."));
wait (2000);
const int thingsToDo = 10;
for (int i = 0; i < thingsToDo; ++i)
{
// must check this as often as possible, because this is
// how we know if the user's pressed 'cancel'
if (threadShouldExit())
return;
// this will update the progress bar on the dialog box
setProgress (i / (double) thingsToDo);
setStatusMessage (String (thingsToDo - i) + T(" things left to do..."));
wait (500);
}
setProgress (-1.0); // setting a value beyond the range 0 -> 1 will show a spinning bar..
setStatusMessage (T("Finishing off the last few bits and pieces!"));
wait (2000);
}
};
[/code]
to the MainDemoWindow.cpp file and add:
Agh… Yes, you’ve found a nasty one there! This is because I changed the way the mac messages get delivered, but it looks like OSX is refusing to let you dispatch any UI events inside a CFTimer callback.
Unfortunately, this will involve some serious re-writing of mac messaging to fix. I’ll do it right away, but not sure when I’ll be able to check in a fix.