Re: Getting mouse clicks when the main loop is busy

2013-11-11 Thread Kyle Sluder
On Nov 10, 2013, at 9:37 PM, Seth Willits sli...@araelium.com wrote: On Nov 10, 2013, at 1:14 PM, Kyle Sluder k...@ksluder.com wrote: On Nov 10, 2013, at 1:06 PM, Charles Srstka cocoa...@charlessoft.com wrote: What I usually do is just have NSDocument's

Re: Getting mouse clicks when the main loop is busy

2013-11-11 Thread Kyle Sluder
On Nov 10, 2013, at 3:57 PM, Charles Srstka cocoa...@charlessoft.com wrote: My app reads complex files that may take up to two minutes to completely load. Beachballing while waiting for it is really not an option. I’m not suggesting you should beachball. I’m suggesting you adopt

Re: Getting mouse clicks when the main loop is busy

2013-11-11 Thread Charles Srstka
On Nov 11, 2013, at 11:59 AM, Kyle Sluder k...@ksluder.com wrote: Shorthand for initializer or one of the methods called by it, like -readFromFileWrapper:ofType:. My point is that it takes a lot of work to subvert NSDocument's understanding of when and how a document is loaded, and simply

Re: Getting mouse clicks when the main loop is busy

2013-11-11 Thread Charles Srstka
On Nov 11, 2013, at 12:09 PM, Kyle Sluder k...@ksluder.com wrote: Inset standard doomsday warning that Lion Autosave will not always be optional Have you got a source for this? Charles ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please

Re: Getting mouse clicks when the main loop is busy

2013-11-10 Thread Uli Kusterer
On 08 Nov 2013, at 20:17, Graham Cox graham@bigpond.com wrote: If the file is small and can be read quickly, it really doesn’t make much difference either way whether it’s threaded or not. But if it’s a large file, there may be some time (even minutes) between clicking ‘Open’ in the

Re: Getting mouse clicks when the main loop is busy

2013-11-10 Thread Uli Kusterer
On 10 Nov 2013, at 13:21, Uli Kusterer witness.of.teacht...@gmx.net wrote: Once that is done, kick off a thread that post-processes the NSData and And by that I don’t necessarily mean NSThread. NSOperationQueue or whatever makes sense and knows more than you about how many cores the machine

Re: Getting mouse clicks when the main loop is busy

2013-11-10 Thread Markus Spoettl
On 11/10/13 1:21 PM, Uli Kusterer wrote: On 08 Nov 2013, at 20:17, Graham Cox graham@bigpond.com wrote: If the file is small and can be read quickly, it really doesn’t make much difference either way whether it’s threaded or not. But if it’s a large file, there may be some time (even

Re: Getting mouse clicks when the main loop is busy

2013-11-10 Thread Graham Cox
On 10 Nov 2013, at 1:21 pm, Uli Kusterer witness.of.teacht...@gmx.net wrote: Are you saying there’s no way to get the async document loading mechanism to open the empty document first, then asynchronously load the data into that window (giving you the opportunity to show partially loaded

Re: Getting mouse clicks when the main loop is busy

2013-11-10 Thread Charles Srstka
On Nov 9, 2013, at 12:39 PM, Kyle Sluder k...@ksluder.com wrote: I would seriously consider implementing this approach. My general idea is to subclass NSDocumentController and put up a progress panel before loading the document. Unfortunately it doesn't look like NSDocumentController

Re: Getting mouse clicks when the main loop is busy

2013-11-10 Thread Kyle Sluder
On Nov 10, 2013, at 1:06 PM, Charles Srstka cocoa...@charlessoft.com wrote: What I usually do is just have NSDocument's readFromData/URL/fileWrapper/etc method not actually do much, and then in windowControllerDidLoadNib: put up a progress bar, and start the loading in a background thread.

Re: Getting mouse clicks when the main loop is busy

2013-11-10 Thread Charles Srstka
On Nov 10, 2013, at 3:14 PM, Kyle Sluder k...@ksluder.com wrote: On Nov 10, 2013, at 1:06 PM, Charles Srstka cocoa...@charlessoft.com wrote: What I usually do is just have NSDocument's readFromData/URL/fileWrapper/etc method not actually do much, and then in windowControllerDidLoadNib: put

Re: Getting mouse clicks when the main loop is busy

2013-11-10 Thread Seth Willits
On Nov 10, 2013, at 1:14 PM, Kyle Sluder k...@ksluder.com wrote: On Nov 10, 2013, at 1:06 PM, Charles Srstka cocoa...@charlessoft.com wrote: What I usually do is just have NSDocument's readFromData/URL/fileWrapper/etc method not actually do much, and then in windowControllerDidLoadNib: put

Re: Getting mouse clicks when the main loop is busy

2013-11-09 Thread Kyle Sluder
On Nov 8, 2013, at 11:17 AM, Graham Cox graham@bigpond.com wrote: The more philosophical question is why do this on the main thread? Part of it has to do with keeping my options open - I can use a thread or not. The situation is in fact handling the file read for NSDocument, so

Getting mouse clicks when the main loop is busy

2013-11-08 Thread Graham Cox
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

Re: Getting mouse clicks when the main loop is busy

2013-11-08 Thread Kyle Sluder
On Nov 8, 2013, at 9:16 AM, Graham Cox graham@bigpond.com wrote: 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

Re: Getting mouse clicks when the main loop is busy

2013-11-08 Thread Fritz Anderson
On 8 Nov 2013, at 11:16 AM, Graham Cox graham@bigpond.com wrote: 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. With the

Re: Getting mouse clicks when the main loop is busy

2013-11-08 Thread Graham Cox
Hi Fritz, Kyle. First off, Kyle is quite right, it’s the -nextEventMatchingMask: I needed. In fact that’s where I started, but didn’t quite get all the pieces lined up. I was only fetching mouse down events, and passing them directly to the button for tracking. That worked, except that the