On Jul 19, 2011, at 11:31 AM, Vincent wrote: > I'm facing a little dilemma: in a modal dialog, I'd like to create a new core > data entity with -[aNSArrayControllerInEntityMode insert:] and initialize > some attributes of this new entity.
I know it’s considered rude to answer a coding question with a UI critique, but the best solution would really be to avoid using a modal dialog at all. They’re a poor user experience compared to a sheet or some other kind of in-window display, and as you’ve seen, they can cause complications with runloops. > However, the creation and insertion of the new entity is delayed one run loop > iteration; but, in a modal dialog, the run loop is stopped! So, what I am to > do? Use -[NSApp beginModalSessionForWindow:] and -[NSApp > endModalSessionForWindow:] instead of just [NSApp runModalForWindow:]? The runloop isn’t stopped, it’s just running nested in a different mode (NSModalPanelRunloopMode). But most API methods that schedule things only schedule them in the default runloop mode, so they won’t get time to run while a model panel is up. The workaround is to use variant scheduling methods that take an array of runloop modes (usually it’s an extra parameter like “inModes:”), and explicitly let them run in the modal mode. —Jens_______________________________________________ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com