Need advice on a custom run-loop mode
Need advice on a custom run-loop mode
- Subject: Need advice on a custom run-loop mode
- From: Graham Cox <email@hidden>
- Date: Fri, 20 May 2016 17:58:19 +1000
Hi all,
I have a situation that I *think* calls for a custom run-loop mode, but I’ve never used such a thing before, so it’s not that clear how to do it.
The situation is this: I want to be able to schedule a repeating timer which will repeatedly invoke Undo until it reaches a certain predefined point. Each Undo could undo anything, but typically has a visual effect. The repeating timer will be slow enough (think 1/4 sec or so) that the user will see a rapid series of things being undone on screen, i.e. the series of Undos is effectively animated. While this series of Undos is happening, I don’t want the user to be able to do anything else that could interrupt it and upset things - it must run to completion. That’s why I’m thinking if I put the run loop into a custom defined mode, and schedule the timer only for that mode, everything else will be automatically suspended for the duration.
First question: does that even sound like a proper use for a custom run-loop mode?
If the answer is yes, how do I cause the run loop to run in that mode? Do I have to run the loop mysef until the operation is done?
If the answer is no, what’s a better way to implement this?
Note that the app already implements Undo, and that Undo covers many different possible operations (all handled in the standard manner), and most of these operations have a visual impact in the appropriate window, but of course each Undo involves a single run of the run loop in its standard mode, performs one Undo task, followed by a standard window update. That’s why I think I need to do this - I need each undo within the series to act as if it’s being run normally, but to disallow the user to interrupt the proceedings until the series is finished. Of course I could run all the Undo operations within a single run loop, but then it’ll be instantaneous and I won’t get the animation effect which I would like to help reinforce the idea that more than one thing is being undone.
—Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden