Hi all, I have the need to display a progress dialog while I open a huge file. The file may be opened on the main thread, and the progress notifications are sent synchronously.
Since the main thread is blocked doing the file opening work, I force the window to redraw by directly calling its -displayIfNeeded method, and that indeed works as expected. However, I would like to be able to click a ‘Cancel’ button in this window. So, I thought I could just allow normal mouse click events to be handled by calling the -runUntilDate: method of the main runloop. By using a date value of -distantPast, this method shouldn’t sleep and so this occasional tickle of the runloop doesn’t slow down the file opening. Unfortunately, it doesn’t work: the mouse clicks are not received and/or processed (I’m not sure which). The Cancel button is just an ordinary button, and if the dialog is displayed as a window without doing any work, I can click the button as normal. I’ve also tried running the runloop as above, then immediately trying to handle any events for the window directly (which seems unnecessary, but I tried it anyway). That doesn’t help. What’s the proper way to do this? I *can* open the file on another thread and let the main thread run normally, and that’s fine, but I do need a solution that works for when the file is opened on the main thread. —Graham _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com