Re: Major Xcode irritation
Yep, I did several times. Was forced to remove DerivedData, because even Clean didn't help. Sent from my iPhone On 12. 8. 2013, at 21:31, Graham Cox graham@bigpond.com wrote: Has anyone else run into this? You open a system header from the SDK into XCode, and due to muscle-memory, absent-mindedness, reflex, lack of context or whatever, you hit cmd-S and save it over the old header (even if it hasn't actually been changed). XCode then refuses to build because the header file mod date no longer matches what was used when the precompiled headers were built. OK, so let's restore that file - oops, no backup because I don't typically back up apps, and the SDK is embedded in the app. OK, download a new SDK from Apple - you can't, the SDK is part of the Xcode download which is 1.6 GB, not a swift download in most people's books. Rebuild the precompiled headers? Probably a fair option, but it's not obvious how one even does that these days, assuming it's still possible (help?). Given that the SDK is embedded in the app, why on earth is it even allowed to overwrite a file there? Why do the permissions allow writing? Mysteries, mysteries... in the meantime I will have lost half a day's productivity just putting this stupid annoyance right. /Gripe If anyone could let me have a copy of NSEvent.h from the XCode 4.6.2 10.8 SDK with the mod date 10/4/2013 12:53AM that would save my sanity and my few remaining hairs - thanks! --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/robert%40tapmates.com This email sent to rob...@tapmates.com ___ 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
Visible range in UITextView
I have a TextView which can be messed up via buttons (e.g. set a new font) but which should keep showing the same range. Like: - (void)applyNewFont: (UIFont *)f { NSRange visibleCharacterRange = self.textView.visibleRange; self.textView.font = f; [ self.textView scrollRangeToVisible: visibleCharacterRange]; } The problem: I cannot find anything like visibleRange or visibleRect. Any workarounds? Gerriet. P.S. On OS X I would do: NSRect visibleRect = [ self.textView visibleRect ]; NSRange visibleGlyphRange = [ layoutManager glyphRangeForBoundingRect: visibleRect inTextContainer: textContainer ]; NSRange visibleCharacterRange = [ layoutManager characterRangeForGlyphRange: visibleGlyphRange actualGlyphRange: NULL ] ; ___ 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
Re: Dismissing Open dlog before doc actually opens
Graham Cox (14/8/13, 06:51) said: They did, which is why first modeless dialogs (from System 1? 2?) and then sheets (OSX 1.0) were developed. Even as far back as the original Inside Macintosh the use of modal dialogs was strongly discouraged when it was possible to use something else. The original system design used a modal Open dialog but this became a modeless dialog in System 7 (1991), if I recall correctly. I must be missing something here. Which Apple applications have non-modal Open dialogs? All the ones that I tried (TextEdit, Preview.app, Safari, Xcode 3.2.6) have modal Open dialogs - you can't do anything in other documents while the Open dialog is displayed. I'm running Snow Leopard, so maybe things are different in Mountain Lion - but Snow Leopard is a long way from System 7. Jeremy ___ 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
Re: Dismissing Open dlog before doc actually opens
running on 10.5.8. Pages '08 Safari 5.0.6 M On Aug 14, 2013, at 3:05 AM, Jeremy Hughes wrote: Graham Cox (14/8/13, 06:51) said: They did, which is why first modeless dialogs (from System 1? 2?) and then sheets (OSX 1.0) were developed. Even as far back as the original Inside Macintosh the use of modal dialogs was strongly discouraged when it was possible to use something else. The original system design used a modal Open dialog but this became a modeless dialog in System 7 (1991), if I recall correctly. I must be missing something here. Which Apple applications have non-modal Open dialogs? All the ones that I tried (TextEdit, Preview.app, Safari, Xcode 3.2.6) have modal Open dialogs - you can't do anything in other documents while the Open dialog is displayed. I'm running Snow Leopard, so maybe things are different in Mountain Lion - but Snow Leopard is a long way from System 7. Jeremy ___ 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
Re: Is it possible to define class from interface builder?
On 13 aug. 2013, at 20:43, Scott Ribe wrote: On Aug 13, 2013, at 12:34 PM, Izak van Langevelde eezac...@xs4all.nl wrote: Is there any way to derive a subclass of NSView from this form, so that it can be reused? NSViewController, combined with a window nib containing the form, so you'd instantiate the nib, pull out the content view, and so on? Works for me, but it feels clumsy that entities created in interface builder can only be reused through code. I had hoped for a more elegant solution. Thanks, Izak --- Grinnikend door het leven... ___ 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
Re: Dismissing Open dlog before doc actually opens
On 14/08/2013, at 12:05 PM, Jeremy Hughes jer...@softpress.com wrote: I must be missing something here. Which Apple applications have non-modal Open dialogs? All the ones that I tried (TextEdit, Preview.app, Safari, Xcode 3.2.6) have modal Open dialogs - you can't do anything in other documents while the Open dialog is displayed. Well, just quickly looking at TextEdit Preview for example, the Open dialog is quite definitely non-modal (10.8). XCode and Safari do have application-modal dialogs. This might be something new since Snow Leopard, maybe due to Powerbox? My memory may be unreliable, but I thought that the Open dialog that was part of Navigation Services (Mac OS 8) was modeless, and that was a more generalised version of the one in System 7.x. At the very least you could switch to another app while the dialog was showing, unlike previous versions. They still had Open/Cancel buttons (and still do in TextEdit, etc), so the appearance is of a modal panel, even though they do not behave totally modally. --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
Strange behaviour of NSLayoutManager
The iPhone Simulator runs this code: - (IBAction)fontSizeSliderHasMoved: sender; { CGPoint contentOffset = self.textView.contentOffset;// we only use x-value, which is always zero NSTextContainer *textContainer = self.textView.textContainer; NSLayoutManager *layoutManager = self.textView.layoutManager; CALayer *layer = self.textView.layer; NSRange visibleGlyphRange = [ layoutManager glyphRangeForBoundingRect: layer.visibleRect inTextContainer: textContainer ]; UIFont *currentFont = self.textView.font; self.textView.font = [ currentFont fontWithSize: self.sizeSlider.value ]; NSRange a = NSMakeRange(0, NSMaxRange(visibleGlyphRange) ); [ layoutManager ensureLayoutForGlyphRange: a ]; CGRect r1 = [ layoutManager lineFragmentUsedRectForGlyphAtIndex: visibleGlyphRange.location effectiveRange: NULL ]; CGFloat lineHeight = r1.size.height; CGFloat strangeDiff; if ( lineHeight 10 ) { strangeDiff = 0.9 * lineHeight; // must not be lineHeight } else if ( lineHeight 90 ) { strangeDiff = 10 - 0.1 * lineHeight; } else { strangeDiff = 1;// must not be negative }; contentOffset.y = r1.origin.y + strangeDiff;// ← why do I need this? [ self.textView setContentOffset: contentOffset animated: NO ]; } The slider moves between 6 pt and 66 pt. When I scroll the TextView so that any line is at the top, then using the slider will keep this same line fixed at the top of the TextView, which is exactly what I want. But: why do I need this strangeDiff? Obviously I am doing something very wrong and silly. But what? Gerriet. ___ 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
Re: Can't type chars into UITextField?
In the simulator, on the device? Which version of iOS are you running? On Aug 14, 2013, at 1:19 AM, Rick Mann wrote: Suddenly a view controller of mine (in an iPad app) is not accepting characters typed in its UITextFields. It DOES accept the delete key, but you can't add characters. Just in case my delegate was somehow messing things up, I set it to nil, but the behavior persists. The field gets focus, the keyboard comes up, but characters can't be added. It is a modal sheet over a navigation controller inside a uiPopovercontroller. When my delegate is connected, the -textFieldDidBeginEditing: and -textFieldDidEndEditing: methods are called as one might expect. But -textField:shouldChangeCharactersInRange:replacementString: is NOT called Any ideas? -- Rick ___ 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
Re: Strange behaviour of NSLayoutManager
All that stuff is unreleased and still under NDA so it can't be discussed on the public cocoa list. You can ask on the devforums however, they're quite active again these days. On 14 Aug, 2013, at 9:43 PM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: The iPhone Simulator runs this code: - (IBAction)fontSizeSliderHasMoved: sender; { CGPoint contentOffset = self.textView.contentOffset;// we only use x-value, which is always zero NSTextContainer *textContainer = self.textView.textContainer; NSLayoutManager *layoutManager = self.textView.layoutManager; ___ 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
Re: Dismissing Open dlog before doc actually opens
On Aug 13, 2013, at 18:56:20, Kyle Sluder k...@ksluder.com wrote: And for a long time you used to have to keep the mouse button held down while navigating a menu hierarchy. Times change. Let's focus on the question, shall we? The fact that -orderOut: didn't dismiss the open panel points at a deeper issue with your code that's probably worth investigating. There most certainly is not a deeper issue with my code. Run this and you'll see for yourself: -(IBAction) openDocument:(id)sender { NSOpenPanel*p = [NSOpenPanel openPanel]; if([p runModal] == NSFileHandlingPanelOKButton) { [p orderOut:self]; // Simulate code that takes 5 seconds to open a document: sleep(5); } } -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 ___ 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
Re: Dismissing Open dlog before doc actually opens
On Aug 14, 2013, at 5:49 AM, Graham Cox graham@bigpond.com wrote: Well, just quickly looking at TextEdit Preview for example, the Open dialog is quite definitely non-modal (10.8). Not for me, also on 10.8. They are application-modal... -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice ___ 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
Provide Feedback on documentation pages is broken
I tried using the Provide Feedback link on one of the dev doc pages and got this: http://twitpic.com/d89x06 I filed a Radar about it: #14735067, in case anyone wants to dupe it, assuming it's not just me. --Andy ___ 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
Re: Dismissing Open dlog before doc actually opens
On 14 Aug, 2013, at 10:03 PM, Steve Mills smi...@makemusic.com wrote: There most certainly is not a deeper issue with my code. Run this and you'll see for yourself: -(IBAction) openDocument:(id)sender { NSOpenPanel*p = [NSOpenPanel openPanel]; if([p runModal] == NSFileHandlingPanelOKButton) { [p orderOut:self]; // Simulate code that takes 5 seconds to open a document: sleep(5); } } What does that code end up doing? Not order the window out, not order it out until after the 5 seconds have elapsed or what? Not much of an OSX guy but something similar on iOS, with a 5 second piece of work on the main thread, would stop the UI animating until it returned control to the runloop. ___ 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
Re: Dismissing Open dlog before doc actually opens
On 14/08/2013, at 4:14 PM, Scott Ribe scott_r...@elevated-dev.com wrote: Not for me, also on 10.8. They are application-modal... Strange - maybe it's due to iCloud support being enabled? I get a different-looking dialog that has iCloud/On My Mac buttons and it's certainly non-modal. But this is getting well off-topic. --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
Re: Provide Feedback on documentation pages is broken
Same thing happened to me yesterday trying to add a note to update the iOS Reachability example to ARC. Were you in the iOS section, the Mac OS section or another section of the doc pages? Do you think that all the Provide Feedback links might be broken like this? On Aug 14, 2013, at 10:20 AM, Andy Lee wrote: I tried using the Provide Feedback link on one of the dev doc pages and got this: http://twitpic.com/d89x06 I filed a Radar about it: #14735067, in case anyone wants to dupe it, assuming it's not just me. --Andy ___ 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/zav%40mac.com This email sent to z...@mac.com ___ 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
Re: Dismissing Open dlog before doc actually opens
On Aug 14, 2013, at 09:23:11, Roland King r...@rols.org wrote: What does that code end up doing? Not order the window out, not order it out until after the 5 seconds have elapsed or what? Not much of an OSX guy but something similar on iOS, with a 5 second piece of work on the main thread, would stop the UI animating until it returned control to the runloop. The window goes away after 5 seconds instead of right when I tell it to go away. And there is no animation for hiding this window - it just disappears. So needing the event loop to run simply to hide this window is a design flaw. -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 ___ 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
Re: Dismissing Open dlog before doc actually opens
On Aug 14, 2013, at 8:23 AM, Graham Cox graham@bigpond.com wrote: Strange - maybe it's due to iCloud support being enabled? I get a different-looking dialog that has iCloud/On My Mac buttons and it's certainly non-modal. But this is getting well off-topic. AHA! I do not have iCloud enabled. And, actually, although I agree that with this insight we've about exhausted the discussion, I don't think it's off-topic yet. How open dialogs work in general is certainly apropos. I do wonder if some people have been confusing open dialogs with save dialogs? Save dialogs did go non-modal a long time ago... -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice ___ 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
Re: Dismissing Open dlog before doc actually opens
On Aug 14, 2013, at 09:21:25, Graham Cox appt...@me.com wrote: Doesn't the main event loop need to run for the window to visibly close? At least the modal session has to finish. If the completion code is run synchronously, it will inevitably delay this until the main loop runs. That must be the case, but it's a poor design. The modal session has finished. You claim that opening the file on a thread doesn't help - I would expect it to since the main loop can run much sooner. I didn't claim it didn't help. I said it doesn't work in our case. Were we a simple Cocoa app without years of legacy and cross-platform code to contend with, then yeah, we could easily stick the file opening code in a background thread. -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 ___ 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
Re: Provide Feedback on documentation pages is broken
I was in the Mac OS section. I tested on another page (NSObject) and that failed too. I wonder if the whole Provide Feedback mechanism is still broken, or perhaps not yet re-enabled, after the recent dev portal shutdown. If it isn't fixed soon I'll just submit a documentation Radar. --Andy On Aug 14, 2013, at 10:27 PM, Alex Zavatone z...@mac.com wrote: Same thing happened to me yesterday trying to add a note to update the iOS Reachability example to ARC. Were you in the iOS section, the Mac OS section or another section of the doc pages? Do you think that all the Provide Feedback links might be broken like this? On Aug 14, 2013, at 10:20 AM, Andy Lee wrote: I tried using the Provide Feedback link on one of the dev doc pages and got this: http://twitpic.com/d89x06 I filed a Radar about it: #14735067, in case anyone wants to dupe it, assuming it's not just me. --Andy ___ 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
Re: Is it possible to define class from interface builder?
On 14 Aug 2013, at 6:48 AM, Izak van Langevelde eezac...@xs4all.nl wrote: On 13 aug. 2013, at 20:43, Scott Ribe wrote: On Aug 13, 2013, at 12:34 PM, Izak van Langevelde eezac...@xs4all.nl wrote: Is there any way to derive a subclass of NSView from this form, so that it can be reused? NSViewController, combined with a window nib containing the form, so you'd instantiate the nib, pull out the content view, and so on? Works for me, but it feels clumsy that entities created in interface builder can only be reused through code. I had hoped for a more elegant solution. I'm curious to know what a more-elegant solution would look like. Having to write code to ask for a copy of a view is only rational: How would you get a new copy without asking? NSViewController takes the name+bundle for a NIB. It loads the view and connects it to your subclass object automatically. Your subclass takes it from there. That looks like the most AppKit (or any other solution) could do for you; Cocoa does everything it knows about, and you code only what's unique to your application. What more do you envision? — F ___ 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
Re: Dismissing Open dlog before doc actually opens
On Aug 14, 2013, at 10:33 AM, Steve Mills wrote: On Aug 14, 2013, at 09:23:11, Roland King r...@rols.org wrote: What does that code end up doing? Not order the window out, not order it out until after the 5 seconds have elapsed or what? Not much of an OSX guy but something similar on iOS, with a 5 second piece of work on the main thread, would stop the UI animating until it returned control to the runloop. The window goes away after 5 seconds instead of right when I tell it to go away. And there is no animation for hiding this window - it just disappears. So needing the event loop to run simply to hide this window is a design flaw. Wild guess, but by any chance are you blocking the thread or blocking the thread that the UI is drawn on? ___ 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
Re: Is it possible to define class from interface builder?
On Aug 14, 2013, at 8:53 AM, Fritz Anderson fri...@manoverboard.org wrote: I'm curious to know what a more-elegant solution would look like. The ability to, graphically using IB (or whatever we're calling it these days) in one nib, embed a view defined in another nib. -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice ___ 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
Re: Dismissing Open dlog before doc actually opens
On Aug 14, 2013, at 21:54:00, Alex Zavatone z...@mac.com wrote: Wild guess, but by any chance are you blocking the thread or blocking the thread that the UI is drawn on? Yes. Refer back to the small sample I sent to illustrate that orderOut doesn't hide the window right away. The header comment for runModal says It returns only after the user has closed the panel. The key word here is closed, which makes it seem like the window should indeed close, not be marked for closure at some later time. -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 ___ 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
Re: Dismissing Open dlog before doc actually opens
On 14/08/2013, at 5:10 PM, Steve Mills smi...@makemusic.com wrote: The header comment for runModal says It returns only after the user has closed the panel. The key word here is closed, which makes it seem like the window should indeed close, not be marked for closure at some later time. Well, there's logically 'closed' and there's having the pixels on the screen removed or updated. The run loop has to run for that to happen in the normal course of things. Design flaw or not (and it's arguable - the continued presence of the Open dialog until there is something new to show could be designed to give the user the feeling that 'something is happening') that's the way it is and like every other app it seems you're stuck with it. File a radar. The only other thing you might try is running the run loop a few cycles in your completion handler so that the orderOut: is processed. It might have unexpected side-effects though, which might also reveal a very good reason why it's not done by default. For example, this works to close the panel immediately: NSOpenPanel*p = [NSOpenPanel openPanel]; if([p runModal] == NSFileHandlingPanelOKButton) { [p orderOut:self]; [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; // Simulate code that takes 5 seconds to open a document: sleep(5); } You claim that opening the file on a thread doesn't help - I would expect it to since the main loop can run much sooner. I didn't claim it didn't help. I said it doesn't work in our case. Were we a simple Cocoa app without years of legacy and cross-platform code to contend with, then yeah, we could easily stick the file opening code in a background thread. OK, that's understandable. But it also means you're stuck - you've tried what you can. File a radar, move on. --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
Re: Dismissing Open dlog before doc actually opens
On Aug 14, 2013, at 10:52:55, Graham Cox graham@bigpond.com wrote: The only other thing you might try is running the run loop a few cycles in your completion handler so that the orderOut: is processed. It might have unexpected side-effects though, which might also reveal a very good reason why it's not done by default. For example, this works to close the panel immediately: NSOpenPanel*p = [NSOpenPanel openPanel]; if([p runModal] == NSFileHandlingPanelOKButton) { [p orderOut:self]; [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; // Simulate code that takes 5 seconds to open a document: sleep(5); } I was trying something similar, but instead was using [NSApp [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:NO]; Which didn't work alone, so I added a 2nd: [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate dateWithTimeIntervalSinceNow:0.3] inMode:NSDefaultRunLoopMode dequeue:NO] Which worked about half the time. I just tried your method of runUntilDate with a time of 0.1 in the future and so far it's working every time. Thanks for that - I wasn't aware of this method. We'll give it a thorough testing. -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 ___ 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
Re: Dismissing Open dlog before doc actually opens
On 14/08/2013, at 5:52 PM, Graham Cox graham@bigpond.com wrote: The only other thing you might try is running the run loop a few cycles in your completion handler so that the orderOut: is processed. It might have unexpected side-effects though, which might also reveal a very good reason why it's not done by default. For example, this works to close the panel immediately: This also does the trick and may well be safer, since it only runs the loop in the modal panel mode, and just the once, according to docs: [p orderOut:self]; [[NSRunLoop mainRunLoop] runMode:NSModalPanelRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; By the way, about the 'orderOut', 'orderFront' methods - I tend to think of these in terms of 'order' as in a food order in a restaurant, not an order that is to be immediately obeyed. The food takes a little time to arrive - so does the actual visible effect of these methods, and it's the run loop that doing the cooking in the kitchen. --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
Re: Dismissing Open dlog before doc actually opens
Steve, Using Graham's NSRunLoop solution, it looks like you don't even need to send -orderOut to the panel. -- Bryan Vines On Aug 14, 2013, at 11:02 AM, Steve Mills smi...@makemusic.com wrote: On Aug 14, 2013, at 10:52:55, Graham Cox graham@bigpond.com wrote: [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1.0]]; I just tried your method of runUntilDate with a time of 0.1 in the future and so far it's working every time. Thanks for that - I wasn't aware of this method. We'll give it a thorough testing. -- Steve Mills ___ 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
Re: Dismissing Open dlog before doc actually opens
On Aug 14, 2013, at 11:53:41, Bryan Vines bkvi...@me.com wrote: Using Graham's NSRunLoop solution, it looks like you don't even need to send -orderOut to the panel. Hmm, most of the time yes. If I go through the dlog quickly, it remains onscreen until the file has been opened. Like if I quickly command-o, type a couple chars to select a file, and return, it will remain. But if I pause a 1/4 second or so before hitting return, it will go away like it should. This is using [[NSRunLoop mainRunLoop] runMode:NSModalPanelRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.5]]; Wait, now it's not working as above. Annoying! I went back to [[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; without calling orderOut first. This is working 100% of the time for my tests. I'm not sure how the other version using NSModalPanelRunLoopMode would actually work in this case, because the model loop has already ended before runModal returned. -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 ___ 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
Re: Dismissing Open dlog before doc actually opens
On Aug 14, 2013, at 08:52 , Graham Cox graham@bigpond.com wrote: Well, there's logically 'closed' and there's having the pixels on the screen removed or updated. The run loop has to run for that to happen in the normal course of things. Actually, it's going to be the Window Server that removes the window from the screen. However, it may be that ordering-out an app window triggers a run loop source or event, which in turn notifies the Window Server. If so, the 'sleep' approach isn't going to work. There may even be multiple [run-loop-triggered] interactions between the app and the Window Server, when a window closes. FWIW, I also discovered (in some roughly similar scenario) that trying to unix-sleep to allow the UI to update isn't a very successful approach. My guess, in Steve's scenario, is that a later part of the document-opening sequence is blocking the main thread for a while, but the interaction with the Window Server isn't fully finished yet, so that it gets snagged by the later blockage, even though the app has gone way beyond its own Open-dialog-handling code. ___ 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
Re: Dismissing Open dlog before doc actually opens
[p orderOut:self]; // Let the run loop finish so the UI updates - button finishes tracking, window updates, etc [self performSelector:@selector(documentOpeningStuff:) withObject:p afterDelay:0]; - Original Message - From: Steve Mills smi...@makemusic.com To: Kyle Sluder k...@ksluder.com Cc: Cocoa dev cocoa-dev@lists.apple.com Sent: Wednesday, August 14, 2013 7:03:59 AM Subject: Re: Dismissing Open dlog before doc actually opens On Aug 13, 2013, at 18:56:20, Kyle Sluder k...@ksluder.com wrote: And for a long time you used to have to keep the mouse button held down while navigating a menu hierarchy. Times change. Let's focus on the question, shall we? The fact that -orderOut: didn't dismiss the open panel points at a deeper issue with your code that's probably worth investigating. There most certainly is not a deeper issue with my code. Run this and you'll see for yourself: -(IBAction) openDocument:(id)sender { NSOpenPanel*p = [NSOpenPanel openPanel]; if([p runModal] == NSFileHandlingPanelOKButton) { [p orderOut:self]; // Simulate code that takes 5 seconds to open a document: sleep(5); } } -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 ___ 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/lrucker%40vmware.com This email sent to lruc...@vmware.com ___ 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
Re: Dismissing Open dlog before doc actually opens
On Aug 14, 2013, at 13:40:00, Lee Ann Rucker lruc...@vmware.com wrote: [p orderOut:self]; // Let the run loop finish so the UI updates - button finishes tracking, window updates, etc [self performSelector:@selector(documentOpeningStuff:) withObject:p afterDelay:0]; As I've already indicated once or twice before, this isn't possible in our current situation. We need to fall back out of the stack of functions that called runModal. They do stuff. -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 ___ 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
Re: Dismissing Open dlog before doc actually opens
On Aug 14, 2013, at 13:11:31, Quincey Morris quinceymor...@rivergatesoftware.com wrote: Actually, it's going to be the Window Server that removes the window from the screen. However, it may be that ordering-out an app window triggers a run loop source or event, which in turn notifies the Window Server. If so, the 'sleep' approach isn't going to work. I only used sleep in that example to illustrate that orderOut was not hiding the window, and that there were not deeper issues in our code base. My guess, in Steve's scenario, is that a later part of the document-opening sequence is blocking the main thread for a while, but the interaction with the Window Server isn't fully finished yet, so that it gets snagged by the later blockage, even though the app has gone way beyond its own Open-dialog-handling code. The document loading code loads a complex document structure, which naturally blocks the main thread. -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 ___ 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
Re: Provide Feedback on documentation pages is broken
I've submitted feedback (on a different docset) since Developer Relations gave the all-clear on its services. — F On 14 Aug 2013, at 9:49 AM, Andy Lee ag...@mac.com wrote: I was in the Mac OS section. I tested on another page (NSObject) and that failed too. I wonder if the whole Provide Feedback mechanism is still broken, or perhaps not yet re-enabled, after the recent dev portal shutdown. If it isn't fixed soon I'll just submit a documentation Radar. --Andy On Aug 14, 2013, at 10:27 PM, Alex Zavatone z...@mac.com wrote: Same thing happened to me yesterday trying to add a note to update the iOS Reachability example to ARC. Were you in the iOS section, the Mac OS section or another section of the doc pages? Do you think that all the Provide Feedback links might be broken like this? On Aug 14, 2013, at 10:20 AM, Andy Lee wrote: I tried using the Provide Feedback link on one of the dev doc pages and got this: http://twitpic.com/d89x06 I filed a Radar about it: #14735067, in case anyone wants to dupe it, assuming it's not just me. --Andy ___ 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/anderson.fritz%40gmail.com This email sent to anderson.fr...@gmail.com ___ 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
Re: Dismissing Open dlog before doc actually opens
With that in mind, any reason why you wouldn't wrap that in a block and dispatch to GCD? Mind you, I only have marginal experience with blocks on iOS, so this is also a question as a suggestion. Sent from my iPad On Aug 14, 2013, at 11:10 AM, Steve Mills smi...@makemusic.com wrote: On Aug 14, 2013, at 21:54:00, Alex Zavatone z...@mac.com wrote: Wild guess, but by any chance are you blocking the thread or blocking the thread that the UI is drawn on? Yes. Refer back to the small sample I sent to illustrate that orderOut doesn't hide the window right away. The header comment for runModal says It returns only after the user has closed the panel. The key word here is closed, which makes it seem like the window should indeed close, not be marked for closure at some later time. -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 ___ 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
Re: Dismissing Open dlog before doc actually opens
On Wed, 14 Aug 2013 09:03:59 -0500, Steve Mills said: There most certainly is not a deeper issue with my code. Run this and you'll see for yourself: -(IBAction) openDocument:(id)sender { NSOpenPanel*p = [NSOpenPanel openPanel]; if([p runModal] == NSFileHandlingPanelOKButton) { [p orderOut:self]; // Simulate code that takes 5 seconds to open a document: sleep(5); } } Are you able to try that on 10.6? I had some similar problems starting with 10.7 because of the document architecture re-architecting. A lot of the openDocument chain is now done (internally) with libdispatch which had some subtle side effects like you describe. I had to use a DTS incident on it eventually. Cheers, -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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
Re: Dismissing Open dlog before doc actually opens
Can't you make the opening a two stage process and use a notification when the window hasbeenclosed to issue the real opening? I wonder if there is a delegate to the open dialog that has events for that. Issuing delays to start a thread blocking operation at this point seems to beg for potential race conditions IMO. Sent from my iPad On Aug 14, 2013, at 2:44 PM, Steve Mills smi...@makemusic.com wrote: On Aug 14, 2013, at 13:11:31, Quincey Morris quinceymor...@rivergatesoftware.com wrote: Actually, it's going to be the Window Server that removes the window from the screen. However, it may be that ordering-out an app window triggers a run loop source or event, which in turn notifies the Window Server. If so, the 'sleep' approach isn't going to work. I only used sleep in that example to illustrate that orderOut was not hiding the window, and that there were not deeper issues in our code base. My guess, in Steve's scenario, is that a later part of the document-opening sequence is blocking the main thread for a while, but the interaction with the Window Server isn't fully finished yet, so that it gets snagged by the later blockage, even though the app has gone way beyond its own Open-dialog-handling code. The document loading code loads a complex document structure, which naturally blocks the main thread. -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 ___ 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/zav%40mac.com This email sent to z...@mac.com ___ 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
Re: Dismissing Open dlog before doc actually opens
On Aug 14, 2013, at 13:58:42, Sean McBride s...@rogue-research.com wrote: Are you able to try that on 10.6? I had some similar problems starting with 10.7 because of the document architecture re-architecting. A lot of the openDocument chain is now done (internally) with libdispatch which had some subtle side effects like you describe. I had to use a DTS incident on it eventually. No, I'm not. I only have 10.7 and 10.8 available. -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 ___ 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
Re: Can't type chars into UITextField?
On Aug 14, 2013, at 18:47 , Alex Zavatone z...@mac.com wrote: In the simulator, on the device? Which version of iOS are you running? Both, 6.1.3 -- Rick ___ 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
Re: Dismissing Open dlog before doc actually opens
On Aug 14, 2013, at 14:01:59, Alex Zavatone z...@mac.com wrote: Can't you make the opening a two stage process and use a notification when the window hasbeenclosed to issue the real opening? Not the way it's currently written. Hopefully we'll be able to rewrite this portion another time. Just not now. I wonder if there is a delegate to the open dialog that has events for that. I haven't seen anything that looks helpful. Issuing delays to start a thread blocking operation at this point seems to beg for potential race conditions IMO. Like I said, that sleep example was only a sample, a stand-in for file loading code, not something in our actual app. -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 ___ 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
Re: Dismissing Open dlog before doc actually opens
On Aug 14, 2013, at 11:44 , Steve Mills smi...@makemusic.com wrote: I only used sleep in that example to illustrate that orderOut was not hiding the window, and that there were not deeper issues in our code base. What I was trying to say is that using 'sleep' -- as it turns out -- can't illustrate anything, because it actually *prevents* the window from being hidden. As Sean just said, there are dueling systems hiding under your reasonable-looking code that prevent it from doing what you intended. The document loading code loads a complex document structure, which naturally blocks the main thread. Sure, and we have no reason to think there's anything wrong with your code. But if it does block the main thread for any significant length of time, there's likely *no* reliable solution, other than a hypothetical rewrite that moves all of the time-consuming bits of the loading into a background thread (which, needless to say, I doubt you're interested in contemplating). Keep in mind that even if you get things running smoothly on your Mac, you have no guarantee that all your customers will see the same good behavior. ___ 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
Re: Can't type chars into UITextField?
If you can run it on a 5.x simulator, does the same thing happen? Sent from my iPad On Aug 14, 2013, at 3:15 PM, Rick Mann rm...@latencyzero.com wrote: On Aug 14, 2013, at 18:47 , Alex Zavatone z...@mac.com wrote: In the simulator, on the device? Which version of iOS are you running? Both, 6.1.3 -- Rick ___ 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
Re: Stale URL bookmarks?
On Tue, Aug 13, 2013 at 10:08 PM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: On Aug 13, 2013, at 19:20 , Tom Harrington atomicb...@gmail.com wrote: What does stale mean in this context? And if the bookmark is stale, what if anything should I do (or not do) in response to that? Stale means that the referenced file could not be found using the explicit information in the bookmark (such as the parent directory and file name), but a plausible alternative *could* be found by assuming information that's either not in the bookmark or that contradicts what's in the bookmark. For example, if the file was renamed, and the bookmark has recorded the file system node number, the original file could be be found via the file number. However, it now has a conflicting name, even though bookmark resolution has decided it's the same file. Now imagine, for example, that the file is accidentally deleted and then restored from a backup, under the newest name. It will likely have a different file number and the original bookmark will now be unresolvable. When you're told that a bookmark is stale, you're being warned that file metadata has changed, and that further metadata changes may break the bookmark. That gives you the opportunity to re-create the bookmark using the latest metadata, rendering the bookmark more tolerant to future metadata changes. You can choose to re-create the bookmark or not. The upside to doing so is that your bookmark may more robustly follow a series of file metadata changes. OTOH you may not want to have your bookmark cling to files that are moved or renamed. Thanks for the detailed explanation, just what I needed. -- Tom Harrington atomicb...@gmail.com AIM: atomicbird1 ___ 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
Re: Dismissing Open dlog before doc actually opens
On Aug 14, 2013, at 14:20:42, Quincey Morris quinceymor...@rivergatesoftware.com wrote: Keep in mind that even if you get things running smoothly on your Mac, you have no guarantee that all your customers will see the same good behavior. Right. That's why we have a great QA department. :) -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 ___ 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
Re: Dismissing Open dlog before doc actually opens
On 14/08/13 16:00 , cocoa-dev-requ...@lists.apple.com wrote: Date: Wed, 14 Aug 2013 14:58:42 -0400 Message-ID: 20130814185842.823741...@mail.rogue-research.com On Wed, 14 Aug 2013 09:03:59 -0500, Steve Mills said: There most certainly is not a deeper issue with my code. Run this and you'll see for yourself: -(IBAction) openDocument:(id)sender { NSOpenPanel*p = [NSOpenPanel openPanel]; if([p runModal] == NSFileHandlingPanelOKButton) { [p orderOut:self]; // Simulate code that takes 5 seconds to open a document: sleep(5); } } Apologies for being late to the thread. I have a similar situation: the NSOpenPanel references a potentially large document which may take nearly a minute to fully open. (I don't use NSDocument, however.) My solution was to pre-create an empty document window and attach the NSOpenPanel to it as a modal sheet with a completion handler like this: NSOpenPanel* panel = [NSOpenPanel openPanel]; [panel beginSheetModalForWindow:theWindow completionHandler:^(NSInteger result) { if (result==NSFileHandlingPanelOKButton) { [self performSelectorOnMainThread:@selector(openTheseURLS:) withObject:[panel URLs] waitUntilDone:NO]; } } I don't need to call orderOut: at all. The main runloop will close the sheet and then process the selected URLs, updating the window as it does so. Not sure how this would play out with NSDocument though... :-/ HTH, -- Rainer Brockerhoff rai...@brockerhoff.net Belo Horizonte, Brazil In the affairs of others even fools are wise In their own business even sages err. http://brockerhoff.net/blog/ ___ 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
Re: Dismissing Open dlog before doc actually opens
OK, but now we're getting into the dodgy bits: // Give windows a chance to display/disappear because we're tracking events in a loop. [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; On Aug 14, 2013, at 11:42 AM, Steve Mills wrote: On Aug 14, 2013, at 13:40:00, Lee Ann Rucker lruc...@vmware.com wrote: [p orderOut:self]; // Let the run loop finish so the UI updates - button finishes tracking, window updates, etc [self performSelector:@selector(documentOpeningStuff:) withObject:p afterDelay:0]; As I've already indicated once or twice before, this isn't possible in our current situation. We need to fall back out of the stack of functions that called runModal. They do stuff. -- Steve Mills office: 952-818-3871 home: 952-401-6255 cell: 612-803-6157 ___ 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
Re: Can't type chars into UITextField?
Sadly, I've already re-done the UI, so I can't test it any more. On Aug 14, 2013, at 12:21 , Alex Zavatone z...@mac.com wrote: If you can run it on a 5.x simulator, does the same thing happen? Sent from my iPad On Aug 14, 2013, at 3:15 PM, Rick Mann rm...@latencyzero.com wrote: On Aug 14, 2013, at 18:47 , Alex Zavatone z...@mac.com wrote: In the simulator, on the device? Which version of iOS are you running? Both, 6.1.3 -- Rick -- Rick ___ 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
Document scope security bookmark, catch 22?
I'm trying to create document scoped security URL bookmarks, for a document format that needs to refer to other documents. But it seems like the first time I save a document, there's a catch-22 in creating the bookmarks. Creating a document scoped bookmark requires my document's URL as one of the arguments. If I implement dataOfType:error:, I can't create a document-scope bookmark in my NSDocument subclass because [self fileURL] is nil. I end up creating an app-scoped bookmark instead, though it's not what I want. If I implement writeToURL:ofType:error:, I get a URL for my document as the first argument. But, I still can't create the bookmark because my document doesn't exist yet. I get an error reading 'The file “[name]” couldn’t be opened because there is no such file'. So, when am I supposed to create these bookmarks? Do I need to have the user save an empty document first just so I can create these bookmarks the next time around? -- Tom Harrington atomicb...@gmail.com AIM: atomicbird1 ___ 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
Re: Document scope security bookmark, catch 22?
This is a problem that's been discussed on the dev forums since the early days of security-scoped bookmarks. How about implement -writeToURL:… so that if the document doesn't have a URL yet, you first create a placeholder file, before overwriting it with the real data? As I understand it, the important thing for bookmarks to work is to attach some metadata to the document, identifying it. On 14 Aug 2013, at 23:00, Tom Harrington atomicb...@gmail.com wrote: I'm trying to create document scoped security URL bookmarks, for a document format that needs to refer to other documents. But it seems like the first time I save a document, there's a catch-22 in creating the bookmarks. Creating a document scoped bookmark requires my document's URL as one of the arguments. If I implement dataOfType:error:, I can't create a document-scope bookmark in my NSDocument subclass because [self fileURL] is nil. I end up creating an app-scoped bookmark instead, though it's not what I want. If I implement writeToURL:ofType:error:, I get a URL for my document as the first argument. But, I still can't create the bookmark because my document doesn't exist yet. I get an error reading 'The file “[name]” couldn’t be opened because there is no such file'. So, when am I supposed to create these bookmarks? Do I need to have the user save an empty document first just so I can create these bookmarks the next time around? -- Tom Harrington atomicb...@gmail.com AIM: atomicbird1 ___ 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/mabdullah%40karelia.com This email sent to mabdul...@karelia.com ___ 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
Cocoaheads tonight, Wednesday 9/14, at 7pm
CocoaHeads Lake Forest will be meeting on the second Wednesday of the month. We will be meeting at the Orange County Public Library (El Toro) community room, 24672 Raymond Way, Lake Forest, CA 92630 We will be talking further about Cocoa Gems, and other recent information from WWDC. Please join us from 7pm to 9pm on Wednesday Bring laptops, code, discussion topics, etc. As always, details can be found on the cocoaheads web site at www.cocoaheads.org ___ 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
Uniquing data in Core Data
I have a boolean property on an Entity for which only one should ever be true. Is it really bad to implement a custom setter that loads every other instance in the MOC that's true and sets them all to false? My code is actually good about always clearing the current one before setting the new one, but when I'm debugging, I will copy data over from another device, and it can't clear the old one in this case. -- Rick ___ 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
Re: Uniquing data in Core Data
On Aug 14, 2013, at 6:28 PM, Rick Mann wrote: I have a boolean property on an Entity for which only one should ever be true. Is it really bad to implement a custom setter that loads every other instance in the MOC that's true and sets them all to false? My code is actually good about always clearing the current one before setting the new one, but when I'm debugging, I will copy data over from another device, and it can't clear the old one in this case. I am not sure if it bad, but it sure smells funny ;-) Anyway, the issue may be more of the data approach. It is likely that the boolean attribute shouldn't belong to the entity at all--i.e. that the attribute is really for needed by some other object or process and is not a function of the entity. A cleaner approach, IMHO, is to have a holder entity whose sole attribute is a to-one relationship to your other entity. Think of it as a singleton that always exist and maintains the particular managed object. It also requires no code at all to maintain uniqueness--simply assign the relationship. HTH, Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ 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
Re: Uniquing data in Core Data
On 2013 Aug 14, at 20:46, Keary Suska cocoa-...@esoteritech.com wrote: A cleaner approach, IMHO, is to have a holder entity whose sole attribute is a to-one relationship to your other entity. Think of it as a singleton that always exist and maintains the particular managed object. Indeed Keary's idea is much better, and furthermore you may well already such an existing singleton entity nearby in that data model, which would be the logical place for this to-one relationship. Just add this relationship to that existing singleton entity. ___ 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
Re: Uniquing data in Core Data
On Aug 14, 2013, at 21:14 , Jerry Krinock je...@ieee.org wrote: On 2013 Aug 14, at 20:46, Keary Suska cocoa-...@esoteritech.com wrote: A cleaner approach, IMHO, is to have a holder entity whose sole attribute is a to-one relationship to your other entity. Think of it as a singleton that always exist and maintains the particular managed object. Indeed Keary's idea is much better, and furthermore you may well already such an existing singleton entity nearby in that data model, which would be the logical place for this to-one relationship. Just add this relationship to that existing singleton entity. On Aug 14, 2013, at 20:46 , Keary Suska cocoa-...@esoteritech.com wrote: On Aug 14, 2013, at 6:28 PM, Rick Mann wrote: I have a boolean property on an Entity for which only one should ever be true. Is it really bad to implement a custom setter that loads every other instance in the MOC that's true and sets them all to false? My code is actually good about always clearing the current one before setting the new one, but when I'm debugging, I will copy data over from another device, and it can't clear the old one in this case. I am not sure if it bad, but it sure smells funny ;-) Anyway, the issue may be more of the data approach. It is likely that the boolean attribute shouldn't belong to the entity at all--i.e. that the attribute is really for needed by some other object or process and is not a function of the entity. A cleaner approach, IMHO, is to have a holder entity whose sole attribute is a to-one relationship to your other entity. Think of it as a singleton that always exist and maintains the particular managed object. It also requires no code at all to maintain uniqueness--simply assign the relationship. Well, I used to store the active instance as a property of my app (AppDelegate). I'd store the NSManagedObjectID as a user default. Unfortunately, I need to be able to sort on the boolean property, and on an NSFetchedResultsController at that, which won't sort on transient properties. Moreover, it seems extraordinarily clumsy to have another entity representing the app, and to only have a singleton of that. -- Rick ___ 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
NSSpellChecker -ignoreWord:… for NSTextCheckingTypeGrammar?
Is NSSpellChecker’s “ignored words” API meant for use with grammar-checking results too? Seems unlikely to me, and yet that’s what appears to be indicated by the documentation and apparent lack of corresponding “-ignoreGrammar…” API. The Spelling and Grammar panel sends -ignoreSpelling: when the user clicks “Ignore” for a grammar-check result, the same as it would do for a spell-check result. And the implementation example in the -ignoreSpelling: reference documentation unconditionally invokes -ignoreWord:inSpellDocumentWithTag: - (void)ignoreSpelling:(id)sender { [[NSSpellChecker sharedSpellChecker] ignoreWord:[[sender selectedCell] stringValue] inSpellDocumentWithTag: myDocumentTag]; } https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSIgnoreMisspelledWords_Protocol/ It’s hard to tell whether the same technique is really meant to be applicable to ignored grammar results, and this bit of documentation wasn’t seen as needing updating when grammar-checking was added, or whether the documentation is in need of update. In the absence of clear info, seems like I should take care to invoke -ignoreWord:… for spell-check results only. If want to be able to ignore grammar results, maybe I need to maintain my own grammar “ignore” list and filter received grammar-check results based on it. Info appreciated if anyone else has run into this. My searching hasn’t turned up any answers. -- Troy Stephens Developer of TypeMetal: The Visual HTML Editor for OS X http://coherencelabs.com/typemetal/ ___ 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
Block gets NULL-ified when animation completes
Hey! I have a method where I update my collection view's layout parameter and want to have a completion block invoked when animation completes: - (void)transitionAnimated:(BOOL)animated completion:(dispatch_block_t)completion { dispatch_block_t updates = ^{ self.layout.maximumScale = self.maximumScale; }; dispatch_block_t finish = ^{ if (completion) { completion(); } }; if (animated) { self.collectionView.userInteractionEnabled = NO; [self.collectionView performBatchUpdates:^{ updates(); } completion:^(BOOL finished) { self.collectionView.userInteractionEnabled = YES; finish(); }]; } else { updates(); [self.layout invalidateLayout]; finish(); } } It works as expected if collection view contains some items. But it crashes if collection view is empty. And it crashes here: } completion:^(BOOL finished) { self.collectionView.userInteractionEnabled = YES; finish(); // CRASH because finish == NULL }]; Debugger says that finish is nil: (lldb) p finish (dispatch_block_t) $1 = parent is NULL What is going on with that block? Any ideas why it gets NULL-ified? ___ 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
Re: Block gets NULL-ified when animation completes
Sounds like you forgot to copy the block — if it’s being invoked after the calling function returns (as a completion handler would) it needs to be copied so it can survive the loss of its original stack frame. —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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Block gets NULL-ified when animation completes
Hey, ARC should drive this for me. If it wouldn’t, then it wouldn’t work in case if there are items in the collection view. Tried to copy manually - no results. BTW, not only «finish», but also «completion» gets NULLified at the last step. Vlad. 15 авг. 2013 г., в 9:22, Jens Alfke j...@mooseyard.com написал(а): Sounds like you forgot to copy the block — if it’s being invoked after the calling function returns (as a completion handler would) it needs to be copied so it can survive the loss of its original stack frame. —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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com