Interface Builder backwards compatibility
Hello all, I am developing an app on my 10.6 machine but try to keep compatibility with 10.4. The binary itself is OK - I can select 10.4 as a target and build a working universal binary. However, I seem to have introduced a problem in the nib file. When testing on 10.4, I started getting [NSToolbar initWithCoder:]: selector not recognized. I can't seem to find an option in IB to save the nib/xib in a compatibility mode. Unfortunately, I also can't open the file on my 10.4 machine either. What's the recommended way of keeping compatibility in your nib files? Thanks, Sander___ 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
Re: Interface Builder backwards compatibility
Le 18 déc. 2009 à 10:48, Sander Stoks a écrit : Hello all, I am developing an app on my 10.6 machine but try to keep compatibility with 10.4. The binary itself is OK - I can select 10.4 as a target and build a working universal binary. However, I seem to have introduced a problem in the nib file. When testing on 10.4, I started getting [NSToolbar initWithCoder:]: selector not recognized. I can't seem to find an option in IB to save the nib/xib in a compatibility mode. Unfortunately, I also can't open the file on my 10.4 machine either. What's the recommended way of keeping compatibility in your nib files? In Interface Builder, you have to set deployment target to 10.4 too for each xib/nib file. Use the menu Window Document Info to do that. Note: Toolbar are not supported for 10.4 nib. -- Jean-Daniel ___ 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
Re: Interface Builder backwards compatibility
In Interface Builder, you have to set deployment target to 10.4 too for each xib/nib file. Use the menu Window Document Info to do that. Ah ha! Thanks, I was looking under a save as or something like that. Note: Toolbar are not supported for 10.4 nib. Ouch. But Tiger apps have toolbars too - do I have to hand-build them there? Thanks, Sander ___ 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
Re: Interface Builder backwards compatibility
Ouch. But Tiger apps have toolbars too - do I have to hand-build them there? Actually, don't answer this. Google knew. --Sander ___ 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
Re: Dirtying NSSearchField
As a follow-up to my own post 2 days ago: When in a document based app I bind the value of an NSTextField (or NSSearchField) in MyDocument.nib to File's Owner someString then I get the unwanted behaviour of the document getting marked as dirty (documentEdited) whenever I type in this NSTextField. The document became clean again when the NSTextField lost focus. This behaviour I consider confusing. Everything now works as I want after adding an Object Controller to MyDocument.nib, connecting it's content outlet to File's Owner and binding the value of the NSTExtField to this Object Controller selection.someString. This, by the way, is my first encounter with a real need for an Object Controller; previously I always thought a direct binding to be equivalent and easier. 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: minimize the window launch startup
thanks for reply. its working fine And one more Question is i want to launch my application at startup, is there any option or any script is there. Regarde, kiran. On Dec 18, 2009, at 9:33 AM, Daniel Brieck Jr. wrote: Kiran, Why do you want the window minimized? Why not set it hidden and then maybe have some other action make it be visible? Daniel J. Brieck Jr. On Dec 17, 2009, at 8:43 AM, kirankumar wrote: hi everyone, i am developing an application in that application when i launch the app, i want to minimize the mainwindow , i use this code in aWakeFromNib, but its not working , can anyone help me plz. [mainwindow setIsMiniaturized:TRUE]; Regarde, kiran The information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system. ___ 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/djbrieck%40mac.com This email sent to djbri...@mac.com The information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system. ___ 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
NSWindow delegate messages question
Hi, All, I'm rather new in Cocoa development, so I have some misunderstanding after API manuals reading. In particular I have a popup panel, opened by a button click in the main window: - (IBAction) btnClick:(id)sender { [popupPanel showWindow]; } I'd like to launch some process (no matter what exactly, it will work in different thread) as soon this popup panel will appear on screen. Of course, I could launch this process from within the same click handler above, but I believe it will be better to do it all in the WindowController's module, related to the popup panel. My question is: what window delegate message should I use? Will it be OK to use windowDidBecomeKey message or should I use windowDidExposed? Or whatever else? Another question is what notification could I use to display an alert box, appearing _after_ this popup window will disappear from screen? For example, I have a Cancel button on this popup panel, which should terminate the launched process and (as a result of NSTask termination notification) panel should be closed. For the sake of simplicity let's imagin, we're closing the panel by button directly: - (IBAction) btnCancelClick:(id)sender { [[self window] close]; } My question is: what window delegate message should I use to show an NSAlert, in order my alert box would appear on screen already _after_ hiding of the popup panel? As far as I can see, there is no windowDidClosed message, but there is only windowWillClose. Is there any easy solution here? Thanks in advance. Best regards, Alexander ___ 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
Intercepting events and touches in UIPickerView subclasses? (or, WTF is going in the UIPickerView's responder chain?)
Hi all, So, I'm working on a client project where he wants to have ActionOne for flicks on the UIPickerView and ActionTwo for non-flick selections. When I subclass UIPIckerView, I explicitly follow the pattern of overriding one of the standard methods for doing this kind of thing, and has worked *very well* in the past: - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event Unfortunately, this method *never fires* in the UIPickerView's responder chain (I suspect it has something to do with the highly-animated nature of UIPickerView). The only methods I can get to fire to give me anything about CGPoint information are: - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event what's interesting about these two methods is that they don't have any UITouch history with them. Sooo they are *mostly useless* also. I've considered applying a UIView on top of the Picker View to intercept the touches and make gesture determinations, since that works very well. But before I go down that road, I thought I'd ask the community what your thoughts are about solving this problem. Again, all I need is for touchesEnded:withEvent: to fire in the responder chain to get what I need. (BTW, the last time this question was asked directly, Google reported back crickets chirping. I hope the same thing doesn't happen this time - I know one of you is smart enough to have already solved this) Namaste + Live Playfully, Sam - If he listens in faith, finding no fault, a man is free and will attain the cherished worlds of those who act in virtue. ___ 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
Re: NSWindow delegate messages question
On 18/12/2009, at 10:12 PM, Alexander Bokovikov wrote: I'd like to launch some process (no matter what exactly, it will work in different thread) as soon this popup panel will appear on screen. Of course, I could launch this process from within the same click handler above, but I believe it will be better to do it all in the WindowController's module, related to the popup panel. My question is: what window delegate message should I use? Will it be OK to use windowDidBecomeKey message or should I use windowDidExposed? Or whatever else? Another question is what notification could I use to display an alert box, appearing _after_ this popup window will disappear from screen? For example, I have a Cancel button on this popup panel, which should terminate the launched process and (as a result of NSTask termination notification) panel should be closed. For the sake of simplicity let's imagin, we're closing the panel by button directly: - (IBAction) btnCancelClick:(id)sender { [[self window] close]; } My question is: what window delegate message should I use to show an NSAlert, in order my alert box would appear on screen already _after_ hiding of the popup panel? As far as I can see, there is no windowDidClosed message, but there is only windowWillClose. Is there any easy solution here? There is an easy solution - do it in your window controller. Since it is responsible for opening and closing the windows, it knows when to cause these other events as well. I wouldn't use window activation or key notifications since that relates purely to its appearance which likely as not has nothing to do with your logic as such - the window coming up and going away are further effects of this logic, not its causes. --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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Subview and window size
I am trying add a subview to an NSView programatically, and am having some difficulty. Here's my code: DNDView *dropview = [[DNDView alloc] init]; NSView *view; if ([dropview superview] != view) { [view addSubview:dropview positioned:NSWindowBelow relativeTo:nil]; } NSRect frame = [dropview frame]; NSRect parentframe = [view frame]; frame.size.width = parentframe.size.width; frame.size.height = parentframe.size.height; [dropview setFrame:frame]; [dropview displayRectIgnoringOpacity:[dropview bounds]] The *view is supposed to take up the entire window, and my idea is to have the subview do so, as well. However, when I add the subview DNDView (which is supposed to be registered to receive file drags), it does not take up the whole window--it takes up approximately 1/4th of the window. How can I get the subview to be the same size as its parent view? Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSArchiver Deprecation
In the class reference and header file for NSArchiver and NSUnarchiver there is not a single mention of depreciation for these two classes. The only place that discusses depreciation is in the Archives and Serializations Programming Guide for Cocoa. It would appear that there are still legitimate needs for the archiver. I think I have one. (It is extremely straight forward archive certain data types using NSArchiver and put it into Core Data.) How safe is it to use NSArchiver in a project? --Richard ___ 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
Re: NSArchiver Deprecation
Why not use NSKeyedArchiver? ___ 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
Re: Subview and window size
On 19/12/2009, at 12:14 AM, Kevin Walzer wrote: I am trying add a subview to an NSView programatically, and am having some difficulty. Here's my code: DNDView *dropview = [[DNDView alloc] init]; This is wrong. The designated initializer for NSView is -initWithFrame: NSView *view; if ([dropview superview] != view) { [view addSubview:dropview positioned:NSWindowBelow relativeTo:nil]; } NSRect frame = [dropview frame]; NSRect parentframe = [view frame]; frame.size.width = parentframe.size.width; frame.size.height = parentframe.size.height; [dropview setFrame:frame]; [dropview displayRectIgnoringOpacity:[dropview bounds]] The *view is supposed to take up the entire window, and my idea is to have the subview do so, as well. However, when I add the subview DNDView (which is supposed to be registered to receive file drags), it does not take up the whole window--it takes up approximately 1/4th of the window. How can I get the subview to be the same size as its parent view? It is the same size, it's just not in the right place, is my guess. Use the correct initializer and pass it the frame you want up front, then just add the subview. There's also no reason to call -displayRectIgnoringOpacity, the view will get drawn on the next cycle as normal. --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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSArchiver Deprecation
On 19/12/2009, at 12:30 AM, Richard Somers wrote: How safe is it to use NSArchiver in a project? I'd say it's safe, because it will be needed for older file formats that can only be read by dearchiving using NSUnarchiver. It's not deprecated, it's just hat newer code is better off using NSKeyedArchiver. From the introductory para of the class ref: In Mac OS X v10.2 and later, NSArchiver and NSUnarchiver have been replaced by NSKeyedArchiver and NSKeyedUnarchiver respectively— see Archives and Serializations Programming Guide for Cocoa. --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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSArchiver Deprecation
hi- On Dec 18, 2009, at 8:30 AM, Richard Somers wrote: In the class reference and header file for NSArchiver and NSUnarchiver there is not a single mention of depreciation for these two classes. The only place that discusses depreciation is in the Archives and Serializations Programming Guide for Cocoa. It would appear that there are still legitimate needs for the archiver. I think I have one. (It is extremely straight forward archive certain data types using NSArchiver and put it into Core Data.) How safe is it to use NSArchiver in a project? It is probably as safe to use it now as it was to use it before. That means you will be responsible for version control and other things that might make serialized binary archives incompatible. It may be safe in the future too because if it was not then that would break a lot of binaries that have no chance of being recompiled anytime soon. It would also disable applications from being able to upgrade their documents from the old format to the new format as there would be no way to read the old format and then write the new format. But, really. Why use a fragile and unappreciated API when you can use the more modern but a little less efficient key value encoder and decoder. p.s.- If you use certain plugins then where you used NSArchiver before you can not use NSArchiver now so NSArchiver IS obsolete for some uses. thanks!- -lance ___ 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
Re: NSArchiver Deprecation
On Dec 18, 2009, at 6:33 AM, Dave Keck wrote: Why not use NSKeyedArchiver? It is extremely straight forward to archive certain non-object data types using NSArchiver and have it interoperate with Core Data and Cocoa bindings. It is extremely cumbersome to do otherwise. Elegant versus messy. --Richard ___ 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
Detecting system protected folders.
Hello In an OutlineView, listing the content of the hard drive. there are some system protected folders that will not allow themselves to be renamed. I would like to disable the possibility of even starting to edit there names in my interface. I would need a function that can tell me if the folder I'm trying to rename is actually a system protected folder. then I can block the operation before it starts in my delegate. is there such a thing? Regards. Sandro.___ 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
Outline View CancelEditing
Hello In an outline View, listing the content of a directory with a custom Image/Text cell I would want to react to the ESC key press to cancel the current editing operation. Using my OutlineView Controller Delegate I can receive the notification that NSResponder's cancelOperation(esc) has been called. But how do I actually cancel the editing operation? Regards. Sandro. ___ 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
Re: Outline View CancelEditing
On 19/12/2009, at 1:35 AM, Sandro Noël wrote: But how do I actually cancel the editing operation? Just make the outline view itself first responder. This will validate and resign the text field if it's OK. [[outlineView window] makeFirstResponder:outlineView]; --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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: App works when launched from Xcode, not from Finder
Yeah I definitely need to squash this bug. But as Greg Parker said, @synchronized (which I'm using) has nothing to do with NSRecursiveLock. And the only other threading related classes I'm using are NSOperationQueue and NSInvocationOperation. Would one of these classes use NSRecursiveLock? I am positive that I'm not directly using NSRecursiveLock or NSLock anywhere in my project. Independent Cocoa Developer, Macatomy Software http://macatomy.com On 2009-12-18, at 12:07 AM, Kai Brüning wrote: Great you found this issue. But according to the log output, it seems that you do have a serious threading-related problem. I wouldn’t ignore this, it may raise its head any time in the future and bite you badly. Good luck Kai On 18.12.2009, at 03:26, PCWiz wrote: Thanks, will do. And regarding Jeremy's note about the 2 libraries can't be loaded, those are Input Manager plugins that have nothing to do with my app. But I'm happy to say that I eventually found the cause of my problem. One of the frameworks I was using was compiled using i386 ppc set as the architecture. Setting this to Standard (32-bit/64-bit Universal) and recompiling the framework fixed it. Xcode seems to launch the app in 32 bit mode whether its in Debug or Release (because I have the Active Architecture set to i386). When launched from Finder, the app launches in 64 bit mode, and since that framework was not compiled with the x86_64 architecture it screwed up the app. Hope this helps anyone else that runs into this issue. Independent Cocoa Developer, Macatomy Software http://macatomy.com On 2009-12-17, at 9:55 AM, Jens Alfke wrote: On Dec 16, 2009, at 10:04 PM, PCWiz wrote: I'm not using NSLock or NSRecursiveLock directly. I'm using @synchronized on an object that multiple threads acess, to allow only one thread to access the object at a time. The fact that the description of the lock is NSRecursiveLock: 0x16c2340 '(null)' makes me suspect that you're synchronizing on a nil pointer, i.e. that when you call @synchronized(foo) { ... } the value of foo is nil. I'm pretty sure that's illegal, and I would have thought it would throw an exception, but maybe not. Try putting a check above the block, something like NSAssert(foo!=nil, @no foo); —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/lists%40kai-bruening.de This email sent to li...@kai-bruening.de ___ 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
Re: NSArchiver Deprecation
On 18 Dec 2009, at 21:52, Dave Keck davek...@gmail.com wrote: Why not use NSKeyedArchiver? Because it can handle only certain strings? Because it creates significanly bigger files? Kind regards, 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: narraycontroller sort performance problems
hey mike the final thought put me on to an easy solution, thanks. i just stopped the controller automaticallly rearranging the content, then called [arrayController rearrangeContent] after a batch of search results has arrived. it still is quite heavy on the processor, but the results arrive in a timely fashion and the ui does not freeze, so good enough i think. On Thu, Dec 17, 2009 at 11:29 PM, Mike Abdullah cocoa...@mikeabdullah.netwrote: Aha, now we're talking! So the problem is that after ever change to your model, the controller must rearrange its content to match. It knows the change is needed because it receives a Key-Value Observing notification of the change. It's got no way to know that more changes are about to happen again very shortly and so shouldn't bother rearranging just yet. Ways to fix: A) Implement manual KVO notifications so that you can do: 1. willChangeValueForKey:… 2. Make all the changes in one go 3. didChangeValueForKey:… B) Temporarily unbind the controller, make your changes, rebind it. C) Make your changes using the controller's own methods. -insertObject:atArrangedObjectsIndex: etc. It's intelligent enough to know not to rearrange the entire content. Final thought, is -automaticallyRearrangesObjects set to YES? I think if that is turned off, the controller won't need to observe every single object in the array. On 17 Dec 2009, at 19:30, Richard wrote: jens, this sounds reasonable, i will give it a try. mike, i did give it a shot in instruments, comparing the same search with and without sorting. i'm not really sure what to make of the results however. when sorting is enabled, nearly all the execution time is taken up with [NSArrayController setContent:] with the time shared evenly over [NSObject removeObserver] and [NSObject addObserver], with only a small fraction of the time taken up by actual sorting. so, it would seem that the extra workload is in the array controller stopping observing the old content, then reobserving the new content. not sure what can be done to alleviate this, any suggestions? On Thu, Dec 17, 2009 at 5:50 PM, Mike Abdullah cocoa...@mikeabdullah.netwrote: As with every performance question. Don't assume, MEASURE. Fire up Instruments and find out what is using up the CPU. On 17 Dec 2009, at 15:22, Richard wrote: hey i have an app that performs searches over a network connection. the app uses core data to manage all the search requests (currently using an in memory store), with an array controller and table view bound to the relevant results. a search query produces up to about 1 results, and they are added to the data model in batches of 10 or so. this all works well, until i add sorting to the array controller. i then find that the CPU use of the application stays at 100% and things go pretty slowly from that point on. i assume this is because with each new search result that is being retrieved and added to the core data model, the array controller is resorting the entire collection of search results? can anyone suggest a solution to this problem? thanks ___ 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/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ 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/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ 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
Re: Intercepting events and touches in UIPickerView subclasses? (or, WTF is going in the UIPickerView's responder chain?)
On Dec 18, 2009, at 6:00 AM, Sam Krishna wrote: Hi all, So, I'm working on a client project where he wants to have ActionOne for flicks on the UIPickerView and ActionTwo for non-flick selections. When I subclass UIPIckerView, I explicitly follow the pattern of overriding one of the standard methods for doing this kind of thing, and has worked *very well* in the past: - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event Unfortunately, this method *never fires* in the UIPickerView's responder chain (I suspect it has something to do with the highly-animated nature of UIPickerView). The only methods I can get to fire to give me anything about CGPoint information are: - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event what's interesting about these two methods is that they don't have any UITouch history with them. Sooo they are *mostly useless* also. Like a number of built in classes, UIPickerView is composed of a number of subviews which actually do the interesting stuff (not unlike the way a UIButton has a UILabel and UIImageView to actually draw a button). As a result, it doesn't do anything, and overriding its touchesXXX methods doesn't do anything useful (since there's probably a scroll view like subview that's actually handling the events). I've considered applying a UIView on top of the Picker View to intercept the touches and make gesture determinations, since that works very well. But before I go down that road, I thought I'd ask the community what your thoughts are about solving this problem. Again, all I need is for touchesEnded:withEvent: to fire in the responder chain to get what I need. Putting a view on top of a built in view works well for doing things like adding things to the appearance of the object, but can be very problematic, since in order for your approach to work, you'll need to forward the events to the real UIPickerView, and forwarding events is extremely problematic. From the documentation (iPhone Application Programming Guide Event Handling Touch Events Handling Multi-Touch Events Forwarding Touch Events): Forwarding Touch Events Event forwarding is a technique used by some applications. You forward touch events by invoking the event-handling methods of another responder object. Although this can be an effective technique, you should use it with caution. The classes of the UIKit framework are not designed to receive touches that are not bound to them; in programmatic terms, this means that the view property of the UITouch object must hold a reference to the framework object in order for the touch to be handled. If you want to conditionally forward touches to other responders in your application, all of these responders should be instances of your own subclasses of UIView. So there are two solutions: 1) Roll your own UIPickerView implementation - surprisingly, not that difficult in many cases. Basically make a UIScrollView (or your own subclass so you can examine the touch events), put a bezel image on top of it, and have each row be a subview inside the scroll view. You'll need some work to handle things like reusing the row cells (since you probably don't want to create a scrolling view with hundreds of subviews). 2) Subclass UIApplication and override sendEvent: - this can get ugly from an architecture point of view (since you no longer have a nice little reusable view - you've got to do major surgery on the application itself), and sendEvent: does a whole lot of work that you'll want to be careful not to break. Glenn Andreas gandr...@gandreas.com The most merciful thing in the world ... is the inability of the human mind to correlate all its contents - HPL ___ 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
Re: App works when launched from Xcode, not from Finder
On 18.12.2009, at 15:54, PCWiz wrote: Yeah I definitely need to squash this bug. But as Greg Parker said, @synchronized (which I'm using) has nothing to do with NSRecursiveLock. And the only other threading related classes I'm using are NSOperationQueue and NSInvocationOperation. Would one of these classes use NSRecursiveLock? Possibly in Leopard, but very unlikely under Snow Leopard: NSOperationQueue is now based on Grand Central. I am positive that I'm not directly using NSRecursiveLock or NSLock anywhere in my project. Have you tried to break on [NSRecursiveLock alloc]? Or on one of the init methods? Kai Independent Cocoa Developer, Macatomy Software http://macatomy.com On 2009-12-18, at 12:07 AM, Kai Brüning wrote: Great you found this issue. But according to the log output, it seems that you do have a serious threading-related problem. I wouldn’t ignore this, it may raise its head any time in the future and bite you badly. Good luck Kai On 18.12.2009, at 03:26, PCWiz wrote: Thanks, will do. And regarding Jeremy's note about the 2 libraries can't be loaded, those are Input Manager plugins that have nothing to do with my app. But I'm happy to say that I eventually found the cause of my problem. One of the frameworks I was using was compiled using i386 ppc set as the architecture. Setting this to Standard (32-bit/64-bit Universal) and recompiling the framework fixed it. Xcode seems to launch the app in 32 bit mode whether its in Debug or Release (because I have the Active Architecture set to i386). When launched from Finder, the app launches in 64 bit mode, and since that framework was not compiled with the x86_64 architecture it screwed up the app. Hope this helps anyone else that runs into this issue. Independent Cocoa Developer, Macatomy Software http://macatomy.com On 2009-12-17, at 9:55 AM, Jens Alfke wrote: On Dec 16, 2009, at 10:04 PM, PCWiz wrote: I'm not using NSLock or NSRecursiveLock directly. I'm using @synchronized on an object that multiple threads acess, to allow only one thread to access the object at a time. The fact that the description of the lock is NSRecursiveLock: 0x16c2340 '(null)' makes me suspect that you're synchronizing on a nil pointer, i.e. that when you call @synchronized(foo) { ... } the value of foo is nil. I'm pretty sure that's illegal, and I would have thought it would throw an exception, but maybe not. Try putting a check above the block, something like NSAssert(foo!=nil, @no foo); —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/lists%40kai-bruening.de This email sent to li...@kai-bruening.de ___ 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
Question about MVC
In Cocoa Design Patterns, Chap 29 re-creates, from scratch, an NSArrayController, dissecting in great detail how it works. The example essentially is a very rudimentary drawing program, which shows rectangles in a view, with a table showing the coordinates of the same. My question relates to the essence of the demo, viz the array of the model objects, specifically an NSArray in the controller. The approach taken is that as each model object is created, it is not added to the array, but a new array is formed with each new model object created, and assigned to the NSArray. So, why would one not simply use an NSMutableArray and simple add or delete model objects. I suspect part of the answer is that assigning a new array allows easier use of KVC but I am not sure as this is not specifically explained. Thanks for your input. ___ 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
Re: Enabling menu items...
Hi, Jim, Try implementing validateMenuItem: instead. It's been my experience that validateUserInterfaceItem: is only called for toolbar items; there may be other cases, but I haven't run across them, and I've never seen it called on menu items. When I do use validateUserInterfaceItem: (for buttons in my UI, for example), I use a subclass of NSButton that implements the NSUserInterfaceValidations protocol, and even then I have to walk the view hierarchy and explicitly call validateUserInterfaceItem: on controls that implement the protocol. Maybe there's a better way to finesse this, but it's what has worked for me. Hope this helps, Doug Knowles On Thu, Dec 17, 2009 at 12:24 PM, Jim Majure jim.maj...@mac.com wrote: Hello, I'm having problems enabling the EditDelete menu item on a custom view. Here's what I have tried: - I have linked the Delete menu item to the delete: selector of the First Responder in IB. - I have implemented the (IBAction) delete: (id) sender; on my custom view. - I have implemented the (BOOL)validateUserInterfaceItem:(id NSValidatedUserInterfaceItem)item on my custom view - I have confirmed that my view is being set as first responder at runtime (via acceptsFirstResponder, becomeFirstResponder, resignFirstResponder) The Delete menu item never becomes enabled. I can get the Cut menu item to enable and activate when tied to the cut: selector, but no luck with Delete. I'm sure that I'm overlooking something very simple, but being a newbie, I can't figure out what. Thanks, Jim ___ 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/knowles.doug%40gmail.com This email sent to knowles.d...@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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Thread safe QT playback
Hi all, QTKit docs say that Quicktime playback is designed to work without interruption on the main thread. This works fairly well, most of the time, but I notice occasional glitches in the playback when the computer is busy, especially when loading web content or reading files (regardless of what app is currently busy, not necessarily mine). So I'm considering doing the playback on a secondary thread. Is this a safe thing to do? Will it improve performance and if so, what's the recommended design pattern? Thanks. Fabian ___ 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
AppleGlot 3.4 not processing XIB files
Hi, I'm trying to localize a project for the first time. I'm setting up a fresh environment with AppleGlot, copying the .string's and .xib's into the environments _NewBase directory, and initiating AppleGlot's initial pass on the environment. AppleGlot lists the .xib files in its progress messages, but there are no strings from or any references to the xib files in the working glossary created by AppleGlot. The console shows error messages indicating a framework loading error (at end of message). I'm betting that I'm getting burned by being too bleeding edge: Xcode and IB v3.2.1 running on Snow Leopard 10.6.2, vs. AppleGlot v3.4. The XIB files are formatted for IB 3.0. Has anybody seen this and know of a workaround? TIA, Doug K; 12/18/09 10:24:52 AM [0x0-0x231231].com.apple.appleglot[2375] SaveProjectInfo 12/18/09 10:24:52 AM AppleGlot[2375] name PerlScriptPlugin, factory PerlScriptPluginCOMFactory, enabled 0 12/18/09 10:24:52 AM AppleGlot[2375] name RTFFilePlugin, factory RTFFilePluginCOMFactory, enabled 0 12/18/09 10:24:52 AM AppleGlot[2375] name PListFilePlugin, factory PListFilePluginCOMFactory, enabled 1 12/18/09 10:24:52 AM AppleGlot[2375] functionP at 0x120578de 12/18/09 10:24:52 AM AppleGlot[2375] name ToolbarFilePlugin, factory ToolbarFilePluginCOMFactory, enabled 0 12/18/09 10:24:52 AM AppleGlot[2375] name XMLFilePlugin, factory XMLFilePluginCOMFactory, enabled 1 12/18/09 10:24:52 AM AppleGlot[2375] functionP at 0x1205a0da 12/18/09 10:24:52 AM AppleGlot[2375] name SearchTermsFilePlugin, factory SearchTermsFilePluginCOMFactory, enabled 1 12/18/09 10:24:52 AM AppleGlot[2375] functionP at 0x1205adae 12/18/09 10:24:52 AM AppleGlot[2375] name RawFileContentPlugin, factory RawFileContentPluginCOMFactory, enabled 1 12/18/09 10:24:52 AM AppleGlot[2375] functionP at 0x1205f6d4 12/18/09 10:24:53 AM AppleGlot[2375] processing 'MainMenu.xib' 12/18/09 10:24:53 AM ibtool[2819] Error loading /Developer/Applications/AppleGlot/AppleGlot.app/Contents/Frameworks/AppleGlot.framework/Versions/A/Resources/AppleGlotIBPlugin.bundle/Contents/MacOS/AppleGlotIBPlugin: dlopen(/Developer/Applications/AppleGlot/AppleGlot.app/Contents/Frameworks/AppleGlot.framework/Versions/A/Resources/AppleGlotIBPlugin.bundle/Contents/MacOS/AppleGlotIBPlugin, 265): no suitable image found. Did find: /Developer/Applications/AppleGlot/AppleGlot.app/Contents/Frameworks/AppleGlot.framework/Versions/A/Resources/AppleGlotIBPlugin.bundle/Contents/MacOS/AppleGlotIBPlugin: no matching architecture in universal wrapper 12/18/09 10:24:53 AM AppleGlot[2375] status $1 for command /Developer/Applications/AppleGlot/AppleGlot.app/Contents/MacOS/../Frameworks/AppleGlot.framework/Resources/ibtoolWrapper --export /Developer/Applications/AppleGlot/AppleGlot.app/Contents/MacOS/../Frameworks/AppleGlot.framework/Resources/ibtool_export_html.plist --exportfile /Volumes/GDrive/Projects/Hacking/SimpleGlot/_NewBase/SimpleProject/English.lproj/MainMenu.xib.plist -B /Developer/Applications/AppleGlot/AppleGlot.app/Contents/MacOS/../Frameworks/AppleGlot.framework/Resources/AppleGlotIBPlugin.bundle -v -O -L /Volumes/GDrive/Projects/Hacking/SimpleGlot/_NewBase/SimpleProject/English.lproj/MainMenu.xib 12/18/09 10:24:53 AM ibtool[2823] Error loading /Developer/Applications/AppleGlot/AppleGlot.app/Contents/Frameworks/AppleGlot.framework/Versions/A/Resources/AppleGlotIBPlugin.bundle/Contents/MacOS/AppleGlotIBPlugin: dlopen(/Developer/Applications/AppleGlot/AppleGlot.app/Contents/Frameworks/AppleGlot.framework/Versions/A/Resources/AppleGlotIBPlugin.bundle/Contents/MacOS/AppleGlotIBPlugin, 265): no suitable image found. Did find: /Developer/Applications/AppleGlot/AppleGlot.app/Contents/Frameworks/AppleGlot.framework/Versions/A/Resources/AppleGlotIBPlugin.bundle/Contents/MacOS/AppleGlotIBPlugin: no matching architecture in universal wrapper 12/18/09 10:24:53 AM AppleGlot[2375] status $1 for command /Developer/Applications/AppleGlot/AppleGlot.app/Contents/MacOS/../Frameworks/AppleGlot.framework/Resources/ibtoolWrapper --export /Developer/Applications/AppleGlot/AppleGlot.app/Contents/MacOS/../Frameworks/AppleGlot.framework/Resources/ibtool_export_html.plist --exportfile /Volumes/GDrive/Projects/Hacking/SimpleGlot/_NewLoc/SimpleProject/English.lproj/MainMenu.xib.plist -B /Developer/Applications/AppleGlot/AppleGlot.app/Contents/MacOS/../Frameworks/AppleGlot.framework/Resources/AppleGlotIBPlugin.bundle -v -O -L /Volumes/GDrive/Projects/Hacking/SimpleGlot/_NewLoc/SimpleProject/English.lproj/MainMenu.xib 12/18/09 10:24:53 AM [0x0-0x231231].com.apple.appleglot[2375] Data Type: .strings 12/18/09 10:24:53 AM [0x0-0x231231].com.apple.appleglot[2375] -1708 12/18/09 10:24:53 AM [0x0-0x231231].com.apple.appleglot[2375] Data Type: .strings 12/18/09 10:24:53 AM [0x0-0x231231].com.apple.appleglot[2375] AppleGlot.app - yield 12/18/09 10:24:53 AM [0x0-0x231231].com.apple.appleglot[2375] skipped 115 times. 12/18/09 10:24:53 AM [0x0-0x231231].com.apple.appleglot[2375] -1708 12/18/09
Re: Thread safe QT playback
Le 18 déc. 2009 à 17:10, slasktrattena...@gmail.com a écrit : Hi all, QTKit docs say that Quicktime playback is designed to work without interruption on the main thread. This works fairly well, most of the time, but I notice occasional glitches in the playback when the computer is busy, especially when loading web content or reading files (regardless of what app is currently busy, not necessarily mine). So I'm considering doing the playback on a secondary thread. Is this a safe thing to do? Will it improve performance and if so, what's the recommended design pattern? Thanks. Fabian Playing QT content on a background thread is error prone, complex and poorly supported. But if you really want to go this way, you will have to read this: http://developer.apple.com/mac/library/technotes/tn/tn2125.html Note that creating thread is not a magic way to improve global OS performances, it's just a way to perform two tasks simultaneously in a single application. If what cause glitches in your app is not related to something you do in your application on the main thread, so this is pretty much useless. But the only way to know is to profile your application. -- Jean-Daniel ___ 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
Re: Outline View CancelEditing
The esc Key is trapped like this inside the View controller that is loaded inside the window. -(BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command { if (command == @selector(cancelOperation:)) { NSLog(@escape key has been pressed); } return NO; } I do not have access to the window instance. How do i get to the window? On 2009-12-18, at 9:48 AM, Graham Cox wrote: On 19/12/2009, at 1:35 AM, Sandro Noël wrote: But how do I actually cancel the editing operation? Just make the outline view itself first responder. This will validate and resign the text field if it's OK. [[outlineView window] makeFirstResponder:outlineView]; --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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: launching login items in root context
On Thu, Dec 17, 2009 at 10:59 PM, Arun arun...@gmail.com wrote: Hi All, Is it possible to launch login items in root context? Words to search for... launchd / launchctl / launch daemon http://developer.apple.com/mac/library/technotes/tn2005/tn2083.html Also if you can focus on Snow Leopard and later check out the following (SMJobBless)... http://developer.apple.com/mac/library/documentation/General/Reference/ServiceManagementFwRef/ServiceManagement_h/index.html -Shawn ___ 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
Re: Thread safe QT playback
Playing QT content on a background thread is error prone, complex and poorly supported. Thanks, I was afraid it would sum up to that. I'll settle with the way things are for the moment, pretty decent. F. On Fri, Dec 18, 2009 at 5:23 PM, Jean-Daniel Dupas devli...@shadowlab.org wrote: Le 18 déc. 2009 à 17:10, slasktrattena...@gmail.com a écrit : Hi all, QTKit docs say that Quicktime playback is designed to work without interruption on the main thread. This works fairly well, most of the time, but I notice occasional glitches in the playback when the computer is busy, especially when loading web content or reading files (regardless of what app is currently busy, not necessarily mine). So I'm considering doing the playback on a secondary thread. Is this a safe thing to do? Will it improve performance and if so, what's the recommended design pattern? Thanks. Fabian Playing QT content on a background thread is error prone, complex and poorly supported. But if you really want to go this way, you will have to read this: http://developer.apple.com/mac/library/technotes/tn/tn2125.html Note that creating thread is not a magic way to improve global OS performances, it's just a way to perform two tasks simultaneously in a single application. If what cause glitches in your app is not related to something you do in your application on the main thread, so this is pretty much useless. But the only way to know is to profile your application. -- Jean-Daniel ___ 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
Re: Intercepting events and touches in UIPickerView subclasses? (or, WTF is going in the UIPickerView's responder chain?)
On Dec 18, 2009, at 7:32 AM, glenn andreas wrote: 2) Subclass UIApplication and override sendEvent: - this can get ugly from an architecture point of view (since you no longer have a nice little reusable view - you've got to do major surgery on the application itself), and sendEvent: does a whole lot of work that you'll want to be careful not to break. The general recommendation is to subclass UIWindow instead of UIApplication. Still override -sendEvent:, but realize that the event has already been given its destiny, you only get to peek at it and possibly embellish, and you should send it on its way ([super sendEvent:]) before you do anything else. And whatever else you do, make sure your quick with it, because -sendEvent: gets called a LOT. -- David Duncan Apple DTS Animation and Printing ___ 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
Re: App works when launched from Xcode, not from Finder
On Dec 17, 2009, at 6:26 PM, PCWiz wrote: But I'm happy to say that I eventually found the cause of my problem. One of the frameworks I was using was compiled using i386 ppc set as the architecture. Setting this to Standard (32-bit/64-bit Universal) and recompiling the framework fixed it. Xcode seems to launch the app in 32 bit mode whether its in Debug or Release (because I have the Active Architecture set to i386). When launched from Finder, the app launches in 64 bit mode, and since that framework was not compiled with the x86_64 architecture it screwed up the app. Xcode lets you set the architecture to execute, and projects brought forth from earlier versions/OSes typically have a 32-bit target set as the architecture to execute. New projects in Xcode 3.2/Snow Leopard should have x86_64 set as their default executable target. -- David Duncan Apple DTS Animation and Printing ___ 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
Re: Enabling menu items...
On Dec 18, 2009, at 7:52 AM, Doug Knowles wrote: It's been my experience that validateUserInterfaceItem: is only called for toolbar items; there may be other cases, but I haven't run across them, and I've never seen it called on menu items. No, that's not true; it's called for menu items as well. It exists so that you don't have to have two separate methods for menu and toolbar items. Jim, are you certain that your validate method isn't being called for the Delete menu item? Have you set a breakpoint or added logging to check? —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
Re: Question about MVC
On Dec 18, 2009, at 7:37 AM, Michael de Haan wrote: So, why would one not simply use an NSMutableArray and simple add or delete model objects. I suspect part of the answer is that assigning a new array allows easier use of KVC but I am not sure as this is not specifically explained. I haven't seen the code, but this is probably because of observing. It's more work to send out KVO notifications when a mutable-array property is mutated; you have to do it manually before and after the change, unless you use some weird tricks using a fake proxy mutable array. —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
Re: Detecting system protected folders.
On Dec 18, 2009, at 6:12 AM, Sandro Noël wrote: there are some system protected folders that will not allow themselves to be renamed. I would like to disable the possibility of even starting to edit there names in my interface. I would need a function that can tell me if the folder I'm trying to rename is actually a system protected folder. Use NSFileManager to check whether you have write access to the directory and its parent directory. —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
Re: Enabling menu items...
So i tried one of the suggestions, which was to add a new menu item (as opposed to using the default one). When I did this, they BOTH started to work. I can't explain what happened. Of course, I would swear that I was doing things right, but... It may have been pure user error, or IB might have a glitch. Thanks for the responses! Jim On Dec 18, 2009, at 11:19 AM, Jens Alfke wrote: On Dec 18, 2009, at 7:52 AM, Doug Knowles wrote: It's been my experience that validateUserInterfaceItem: is only called for toolbar items; there may be other cases, but I haven't run across them, and I've never seen it called on menu items. No, that's not true; it's called for menu items as well. It exists so that you don't have to have two separate methods for menu and toolbar items. Jim, are you certain that your validate method isn't being called for the Delete menu item? Have you set a breakpoint or added logging to check? —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
Re: Core Video - Getting Started
Travis, Using Core Video in it's rawest form might be a little bit of overkill for this problem (IMHO). Have you tried using a collection of QTMovieLayers and QTMovie objects in a layer-hosted view? regards, douglas On Dec 16, 2009, at 7:43 PM, Travis Kirton wrote: Hi, I'm planning a project where I'll be running somewhere between 15 and 20 videos on screen, any number of them could be playing at the same time (not necessarily in sync). I got an example running with Core Animation and Layers using very little code, actually adapted from: http://www.cimgf.com/2008/09/10/core-animation-tutorial-rendering-quicktime-movies-in-a-caopengllayer/ But, the final intention would be to have a bunch of videos moving around on screen. So, I thought it would be better to build this using the Core Video frameworks. I am looking through the CoreVideo(101,102,103...) example projects now. I'm wondering if anyone can confirm that I should be going in this direction or not? Thanks, T___ ___ 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
Re: 2D grayscale image from an array of floats
Martin, Have you looked at the API for CGImage? If not, this may be helpful as well. regards, douglas On Dec 17, 2009, at 9:25 AM, Martin Beroiz wrote: On Dec 17, 2009, at 6:17 AM, Graham Cox wrote: On 17/12/2009, at 5:32 AM, Martin Beroiz wrote: Can anyone please give me any hint on what would be the best approach to this problem? or may be point me some relevant documentation I might read? I know nothing about bitmap image representation, so any pointer on that would appreciated too. I'd say that's exactly what you want - NSBitmapImageRep. You can use its setPixelAtX:y: method to set each pixel individually, provided that ultra-high performance isn't a key requirement. The rep can be drawn directly into a view or wrapped with an NSImage and drawn using that. Look up that class in the docs and it also links to other relevant docs and samples. --Graham Thanks, I'm trying that already. I don't need high performance right now, but just out of curiosity, what would I use if I wanted ultra high performance? ___ 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
Re: NSUndoManager auto-grouping?
On 2009 Dec 17, at 04:29, Graham Cox wrote: [speaking of NSUndoManager] It's also a black box with a large private API and internal structure unpublished, undocumented and difficult to override or figure out what's happening when it's not co-operating. I would be SOO HAPPY if Apple would just somehow let me have a teeny-tiny peek at the Undo Stack -- if only for debugging purposes. We don't even get a -count :( I outlined some of the rationale I had for writing my own Undo class on my website: http://apptree.net/gcundomanager.htm Great news that you've got it done -- and with actual documentation including Implementation Details! I'll let you know maybe next week if GCUndoManager is ready for Core Data. Or more accurately, is Core Data ready for and undo manager that implements its documented API, nothing more and nothing less? (Looking for a bigger hard drive to log all the expected exceptions...) ___ 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
Re: Detecting system protected folders.
On 2009-12-18, at 12:25 PM, Jens Alfke wrote: On Dec 18, 2009, at 6:12 AM, Sandro Noël wrote: there are some system protected folders that will not allow themselves to be renamed. I would like to disable the possibility of even starting to edit there names in my interface. I would need a function that can tell me if the folder I'm trying to rename is actually a system protected folder. Use NSFileManager to check whether you have write access to the directory and its parent directory. —Jens Jens, thank you, I ha thought about it but i thought it was to simple. cheers. ___ 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
Dependent values that are not iVars
I would like to know the correct way to implement a non-stored value that is dependent on members of a collection. I am setting up the object that holds the dependent value as an observer of the individual members of the collection like this: [theFrameModule addObserver:self forKeyPath:kOverallWidth options:NSKeyValueObservingOptionNew context:NULL]; And I use the following to see when one of the items in the collection has changed: - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if ([keyPath isEqualToString:kOverallWidth]) { NSLog(@got notification that overallwidth changed: %@, object); } } This works just fine. I get notified of the changes to the members of the collection. But my question is this: I want my dependent value to exist very simply as a method. I don't need or want it to be an ivar of its object. So something like this: -(NSInteger)overallWidth; { NSInteger overallWidthSubtotal = 0; for ( SLFrameModule * theModule in [self frameModules] ) { overallWidthSubtotal += [theModule overallWidth]; } return overallWidthSubtotal; } My problem is that when I use overallWidth in a binding, the value does not get updated. There is some tickle that is not occurring. I have replaced my -overallWidth method above with an iVar, and that does work, but I would rather have it exist solely as the method above. Is there any way to put something in my - observeValueForKeyPath: method that will tell the KVO system that overallWidth would be a different value if checked? Thank you ___ 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
Re: Detecting system protected folders.
On 2009-12-18, at 1:11 PM, Sandro Noël wrote: On 2009-12-18, at 12:25 PM, Jens Alfke wrote: On Dec 18, 2009, at 6:12 AM, Sandro Noël wrote: there are some system protected folders that will not allow themselves to be renamed. I would like to disable the possibility of even starting to edit there names in my interface. I would need a function that can tell me if the folder I'm trying to rename is actually a system protected folder. Use NSFileManager to check whether you have write access to the directory and its parent directory. —Jens it does not work, even if i select the root folder of my hard drive i still get the permission to rename it. BOOL valid = [[NSFileManager defaultManager] isWritableFileAtPath:[node.nodeURL path]]; BOOL validParent = [[NSFileManager defaultManager] isWritableFileAtPath:[[node.nodeURL URLByDeletingLastPathComponent]path]]; return (valid validParent); Any other ideas?___ 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
Re: Command+Option+Return not sent to doCommandBySelector:
On Dec 17, 2009, at 12:16 AM, Gideon King wrote: I have a custom view that implements the NSTextInputClient protocol, and it successfully receives doCommandBySelector: method calls for just about every other non-text entry key combination, but Command+Option+Return just doesn't get there (or to anything else in the NSTextInputClient protocol). As an experiment, I implemented every action method I saw in the NSResponder class, in case it had been interpreted by something else which was just swallowing it, but none of those methods was being called for this key combination. Obviously I can pick it up in keyDown: if necessary, but I had hoped to not need to do that... Anybody know how I can get Command+Option+Return to call doCommandBySelector: as all the other keystrokes do? IIRC, command-option-return is not in the standard key bindings, so there is no selector assigned to it. There's a chart of key bindings and selectors at http://www.hcs.harvard.edu/~jrus/Site/System%20Bindings.html -Ross ___ 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
Re: Dependent values that are not iVars
On Dec 18, 2009, at 10:20, Paul Bruneau wrote: I am setting up the object that holds the dependent value as an observer of the individual members of the collection like this: [theFrameModule addObserver:self forKeyPath:kOverallWidth options:NSKeyValueObservingOptionNew context:NULL]; And I use the following to see when one of the items in the collection has changed: - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if ([keyPath isEqualToString:kOverallWidth]) { NSLog(@got notification that overallwidth changed: %@, object); } } This works just fine. I get notified of the changes to the members of the collection. But my question is this: I want my dependent value to exist very simply as a method. I don't need or want it to be an ivar of its object. So something like this: -(NSInteger)overallWidth; { NSInteger overallWidthSubtotal = 0; for ( SLFrameModule * theModule in [self frameModules] ) { overallWidthSubtotal += [theModule overallWidth]; } return overallWidthSubtotal; } My problem is that when I use overallWidth in a binding, the value does not get updated. There is some tickle that is not occurring. This is a situation where you use willChangeValueForKey:/didChangeValueForKey: - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if ([keyPath isEqualToString:kOverallWidth]) { [self willChangeValueForKey:@overallWidth]; NSLog(@got notification that overallwidth changed: %@, object); [self didChangeValueForKey:@overallWidth]; } } A couple of things I notice: 1. You have 2 identically named properties (overallWidth) in related objects. My experience has been that if there's ever anything wrong with (say) your bindings, it gets incredibly confusing working out from logged error messages *which* property has the problem. You can save yourself some grief by renaming (say) your dependent property to (say) overallWidthSubtotal. 2. Your observer method is stripped down, right? You are really using a unique value for the context parameter, right? It's not really safe to just not care. 3. Your dependent property is *also* dependent on the array itself. You will also put the willChange/didChange invocations in the place(s) where you add/remove/replace objects in the underlying array, yes? 4. The use of willChange/didChange in the observer method causes a nested KVO notification. (It triggers at the didChange invocation.) In general, you have to be a little careful that your observer method puts your object in an internally consistent state before triggering the notification, and that you don't cause any infinite notification loops. This is likely not a problem if this is all your code, but it's something to keep in mind. (Actually, it's a potential issue anywhere you trigger a nested notification, such as when you set a property inside a different property setter method.) ___ 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
Re: Dependent values that are not iVars
On Dec 18, 2009, at 2:08 PM, Quincey Morris wrote: This is a situation where you use willChangeValueForKey:/ didChangeValueForKey: - (void)observeValueForKeyPath:(NSString *)keyPath ofObject: (id)object change:(NSDictionary *)change context:(void *)context { if ([keyPath isEqualToString:kOverallWidth]) { [self willChangeValueForKey:@overallWidth]; NSLog(@got notification that overallwidth changed: %@, object); [self didChangeValueForKey:@overallWidth]; } } Ahh, of course, thank you Quincey! A couple of things I notice: 1. You have 2 identically named properties (overallWidth) in related objects. My experience has been that if there's ever anything wrong with (say) your bindings, it gets incredibly confusing working out from logged error messages *which* property has the problem. You can save yourself some grief by renaming (say) your dependent property to (say) overallWidthSubtotal. OK I see what you are saying. I will rename one or both of them. 2. Your observer method is stripped down, right? You are really using a unique value for the context parameter, right? It's not really safe to just not care. No, I'm not using context. My feeling was that since I am checking for the keypath, that is all I needed to care about. Can you elaborate about the unsafeness of that? Thank you. 3. Your dependent property is *also* dependent on the array itself. You will also put the willChange/didChange invocations in the place(s) where you add/remove/replace objects in the underlying array, yes? Yes, thanks for the note on that. I had already noticed that I needed that for when objects in the collection get added or removed. 4. The use of willChange/didChange in the observer method causes a nested KVO notification. (It triggers at the didChange invocation.) In general, you have to be a little careful that your observer method puts your object in an internally consistent state before triggering the notification, and that you don't cause any infinite notification loops. This is likely not a problem if this is all your code, but it's something to keep in mind. (Actually, it's a potential issue anywhere you trigger a nested notification, such as when you set a property inside a different property setter method.) I think I have a vague understanding of what you are saying. I *think* I'm OK in this area but I will watch out for problems. Thanks again! ___ 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
Re: Dependent values that are not iVars
On Fri, Dec 18, 2009 at 11:18 AM, Paul Bruneau paul_brun...@special-lite.com wrote: if ([keyPath isEqualToString:kOverallWidth]) { [self willChangeValueForKey:@overallWidth]; NSLog(@got notification that overallwidth changed: %@, object); [self didChangeValueForKey:@overallWidth]; } Please note that it is not correct to call -will/didChangeValueForKey: without actually changing the value. The KVO mechanism might just simply not send a notification at all. (Well, I guess it's valid, but you might see fewer observation notifications than you would expect.) This is difficult to get right with derived properties. Also don't have the first inclination I had, which is to use -keyPathsForValuesAffectingValueForKey:. As described in the documentation, it will not work. --Kyle Sluder ___ 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
Re: Picking and Selection
On Dec 18, 2009, at 12:27 PM, jon klein wrote: simple approach is to code each object in the scene with a unique color, render the scene with all lighting, blending, etc turned off, then readback the single pixel at the desired coordinates. For the unique colors, you can just increment an integer counter and pull out R, G, B values for each object. If the depth buffer is turned off, would you be able to read all pixels at a particular location? I need access to all objects with a pixel at a location not just the top most. --Richard ___ 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
Re: Dependent values that are not iVars
On Dec 18, 2009, at 2:28 PM, Kyle Sluder wrote: On Fri, Dec 18, 2009 at 11:18 AM, Paul Bruneau paul_brun...@special-lite.com wrote: if ([keyPath isEqualToString:kOverallWidth]) { [self willChangeValueForKey:@overallWidth]; NSLog(@got notification that overallwidth changed: %@, object); [self didChangeValueForKey:@overallWidth]; } Please note that it is not correct to call -will/didChangeValueForKey: without actually changing the value. The KVO mechanism might just simply not send a notification at all. (Well, I guess it's valid, but you might see fewer observation notifications than you would expect.) This is difficult to get right with derived properties. Also don't have the first inclination I had, which is to use -keyPathsForValuesAffectingValueForKey:. As described in the documentation, it will not work. Ugh, so I guess you are saying that derived properties are not trustworthy in this usage? I like them so much because then I never have to worry about the stored value being out of date (which admittedly, if I do everything exactly right, I guess it will never be out of date, but I like not having to worry about it). It's also a bummer because so far it is working fabulously with willChange/didChange. I might live dangerously and leave it in until it bites me. Thanks for the warning, I'll make note of it. ___ 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
Re: Dependent values that are not iVars
On Fri, Dec 18, 2009 at 11:48 AM, Paul Bruneau paul_brun...@special-lite.com wrote: Ugh, so I guess you are saying that derived properties are not trustworthy in this usage? No, just that if you don't actually change the value, KVO might not bother notifying listeners. The actual values are fine, just wanted to address this issue in case you see fewer change notifications than you expect in the course of your debugging. --Kyle Sluder ___ 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
Re: Question about MVC
Thanks Jens, I thought it was something like that. On Dec 18, 2009, at 9:21 AM, Jens Alfke wrote: On Dec 18, 2009, at 7:37 AM, Michael de Haan wrote: So, why would one not simply use an NSMutableArray and simple add or delete model objects. I suspect part of the answer is that assigning a new array allows easier use of KVC but I am not sure as this is not specifically explained. I haven't seen the code, but this is probably because of observing. It's more work to send out KVO notifications when a mutable-array property is mutated; you have to do it manually before and after the change, unless you use some weird tricks using a fake proxy mutable array. —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
Re: Dependent values that are not iVars
On Dec 18, 2009, at 11:18, Paul Bruneau wrote: 2. Your observer method is stripped down, right? You are really using a unique value for the context parameter, right? It's not really safe to just not care. No, I'm not using context. My feeling was that since I am checking for the keypath, that is all I needed to care about. Can you elaborate about the unsafeness of that? Thank you. Your code may not be the only place an observation was added. In particular, the superclass may have done so too. Therefore, you're supposed to invoke the super implementation of the observer method, but *only* if the observation is not one you registered. How do you know if it's one you registered? You have to use the context parameter to recognize your own registrations. Some people use globally unique strings for the context. I tend to use the class: [addObserver: ... forKeyPath: ... options: ... context: [MyClass class]]; (note that [self class] would be wrong, because subclasses need their own unique contexts too). Incidentally, checking just the key path is a mistake too. You also need to check at least the class of the object passed to the observer method. In your original example, if the class with the dependent property ever tried to observe overallWidth on itself, things would be messed up because you'd have observations of two properties in different classes but with the same key funneling through the same observer method. If this all sounds like a horrible defect in the the observer mechanism -- it is. ___ 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
Re: NSUndoManager auto-grouping?
This post describes how to dump the NSUndoManager stacks. I found it helpful when debugging undo manager crashes. http://parmanoir.com/Inspecting_NSUndoManager's_undo_stack ___ 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
Re: Detecting system protected folders.
Sandro Noël wrote: it does not work, even if i select the root folder of my hard drive i still get the permission to rename it. What effective user id is it running as? What groups is that user id a member of? Run this Terminal command to identify the user: id -p Run this Terminal command to examine permissions: ls -ld / If / is writable by the identified user, then it's working correctly. That may not be what you want or expect, but it's correct for the code you've shown. If the code isn't doing what you want, then please explain more precisely what you want to happen. Give examples. There are very few things that are system protected in any way other than by Posix permissions or ACLs. I'm almost certain that NSFileManager is using nothing but those to determine writability. My guess is that it's using the system call access(2); read 'man access'. -- GG___ 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
Re: Dependent values that are not iVars
On Dec 18, 2009, at 2:56 PM, Kyle Sluder wrote: On Fri, Dec 18, 2009 at 11:48 AM, Paul Bruneau paul_brun...@special-lite.com wrote: Ugh, so I guess you are saying that derived properties are not trustworthy in this usage? No, just that if you don't actually change the value, KVO might not bother notifying listeners. The actual values are fine, just wanted to address this issue in case you see fewer change notifications than you expect in the course of your debugging. Oh, OK. In my case, I don't need (or even want) a notification if the value doesn't change, so even if the KVO system doesn't notify my listeners in case of an unchanged derived value, I won't mind. Thank you ___ 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
Re: Dependent values that are not iVars
On 12/18/09 12:13 PM, Quincey Morris said: Some people use globally unique strings for the context. I tend to use the class: [addObserver: ... forKeyPath: ... options: ... context: [MyClass class]]; I suppose that usage is safe, but in general it's dangerous to use an Obj-C object for the context, at least in GC apps. That's because context is a void* and therefore not __strong. What I do (based on a similar discussion on this list some time ago, is to declare globals like: uint8_t kContext1 = helpful # for debugging; then use kContext1 as the context. -- 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Menu items unexpectedly disabled
I have a document-based app. For each document there can be a couple of satellite windows brought up for specific views of some of the data. Each of these satellite windows is controlled by an NSWindowController subclass loaded by MyDocument and added via addWindowController:. A menu item's target is the First Responder, and the method to implement the action is in MyDocument. Everything works as expected when the primary window is key. The problem is that when one of the satellite windows is key, menu items implemented by MyDocument are disabled. I thought the responder chain went through the NSWindowController and then through to its NSDocument? Or is this only the case when for the document's primary window (and NSWindowController)? Note: The work around is trivial. I just implemented the method name in the satellite window's NSWindowController subclass and forwarded the call to the document: -(IBAction) doMenuThing: (id)sender { [[self document] doMenuThing: sender]; } but I feel this isn't the Cocoa Way of doing it. Am I missing a configuration step? Todd ___ 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
Re: Command+Option+Return not sent to doCommandBySelector:
Thanks Ross. I have done some more research and found that the complete mapping dictionary is stored in /System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBinding.dict, and that it defines a whole lot of other key mappings that are mapped to the noop: selector, for instance Command+Shift+Return and Command+Return both send a noop: selector. I also found in the documentation that there is no way of changing this at runtime. At least I now understand what is going on and why, even if I find the system somewhat inflexible. Gideon IIRC, command-option-return is not in the standard key bindings, so there is no selector assigned to it. There's a chart of key bindings and selectors at http://www.hcs.harvard.edu/~jrus/Site/System%20Bindings.html -Ross ___ 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
Re: Menu items unexpectedly disabled
On 19/12/2009, at 6:50 AM, Todd Heberlein wrote: I have a document-based app. For each document there can be a couple of satellite windows brought up for specific views of some of the data. Each of these satellite windows is controlled by an NSWindowController subclass loaded by MyDocument and added via addWindowController:. A menu item's target is the First Responder, and the method to implement the action is in MyDocument. Everything works as expected when the primary window is key. The problem is that when one of the satellite windows is key, menu items implemented by MyDocument are disabled. I thought the responder chain went through the NSWindowController and then through to its NSDocument? Or is this only the case when for the document's primary window (and NSWindowController)? That's correct, and that's how it should work. It works here in a test app. Are you doing anything unusual in your NSWindowController? What methods are you overriding? -- Rob Keniger ___ 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
Re: App works when launched from Xcode, not from Finder
Thanks, that's helpful to know. Kai, I am developing on Snow Leopard but I'm using the 10.5 SDK, so is it possible that NSRecursiveLock is being used in NSOperationQueue? Or should I set a breakpoint on [NSRecursiveLock alloc] to see where its being allocated? Independent Cocoa Developer, Macatomy Software http://macatomy.com On 2009-12-18, at 10:14 AM, David Duncan wrote: On Dec 17, 2009, at 6:26 PM, PCWiz wrote: But I'm happy to say that I eventually found the cause of my problem. One of the frameworks I was using was compiled using i386 ppc set as the architecture. Setting this to Standard (32-bit/64-bit Universal) and recompiling the framework fixed it. Xcode seems to launch the app in 32 bit mode whether its in Debug or Release (because I have the Active Architecture set to i386). When launched from Finder, the app launches in 64 bit mode, and since that framework was not compiled with the x86_64 architecture it screwed up the app. Xcode lets you set the architecture to execute, and projects brought forth from earlier versions/OSes typically have a 32-bit target set as the architecture to execute. New projects in Xcode 3.2/Snow Leopard should have x86_64 set as their default executable target. -- David Duncan Apple DTS Animation and Printing ___ 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
Re: Menu items unexpectedly disabled
That's correct, and that's how it should work. It works here in a test app. Are you doing anything unusual in your NSWindowController? What methods are you overriding? My bad. After getting your email I kept dug around a bit more, and I discovered I had not connected the NSWindowController subclasses' window outlets to the NIB's windows. Once I did that, everything started working. Thanks, Todd ___ 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
Re: App works when launched from Xcode, not from Finder
On Fri, Dec 18, 2009 at 3:15 PM, PCWiz pcwiz.supp...@gmail.com wrote: Thanks, that's helpful to know. Kai, I am developing on Snow Leopard but I'm using the 10.5 SDK, so is it possible that NSRecursiveLock is being used in NSOperationQueue? Or should I set a breakpoint on [NSRecursiveLock alloc] to see where its being allocated? SDKs are stub libraries, they don't contain code (of course they can set binary flags that trigger compatibility modes)... Anyways why guess? Set the break point (or better yet use Instruments) and track down the source. -Shawn ___ 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
Re: 2D grayscale image from an array of floats
A couple more things I've thought of: - There is such a thing as a grayscale image that uses floats instead of bytes for values. You may not even need to do a conversion. - You may even be able to wrap your buffer up in an image rep without copying it. I don't use NSImage; my custom image views do some drawing at lower levels; so I don't know for sure what all formats are supported. You'd have to study the docs more. As a newbie, the first thing you should probably do is take the shortest path to getting something on the screen, in other words finish what you were already doing--then experiment with ways to avoid conversion and/or copying. -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSApplicationLoad() can't connect to window server in user logged out.
Ok, so I've done some more research and found this http://developer.apple.com/mac/library/technotes/tn2005/tn2083.html#SECPRELOGINANDTRUST, it basically says to run it in the loginwindow, but I can't do that with apache which is what I'm running my code with. Because this is a personal application I wouldn't mind doing things the hacking way and some how make the windowserver trust apache. On Dec 18, 2009, at 6:06 PM, Mr. Gecko wrote: Hello I'm running 10.5 and I'm trying to do some image drawing with NSImage in Terminal via SSH and it seems like every time I try, I get this error _RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL. 2009-12-18 17:54:04.963 weather.mgm[655:10b] *** -[NSRecursiveLock unlock]: lock (NSRecursiveLock: 0x121b30 '(null)') unlocked when not locked 2009-12-18 17:54:04.973 weather.mgm[655:10b] *** Break on _NSLockError() to debug. 2009-12-18 17:54:04.978 weather.mgm[655:10b] An uncaught exception was raised 2009-12-18 17:54:05.009 weather.mgm[655:10b] Error (1002) creating CGSWindow 2009-12-18 17:54:05.014 weather.mgm[655:10b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1002) creating CGSWindow' 2009-12-18 17:54:05.040 weather.mgm[655:10b] Stack: ( 2513718512, 2536973548, 2513718272, 2513718328, 2470748316, 2470747564, 2470746864, 2470746400, 2470743808, 2470755712, 2470754620, 2470754184, 2470743272, 8540 ) I know this code I'm using works as it runs perfectly fine on Snow Leopard via SSH but for some reason it doesn't work on Leopard, what could be wrong here? How can I get this working on Leopard? Basic code to this is int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSApplicationLoad(); NSImage *image = [[NSImage alloc] initWithContentsOfFile:@/background.png]; NSSize imageSize = [image size]; [image lockFocus]; NSImage *type = [[NSImage alloc] initWithContentsOfFile:@/icons/93x93/1.png]; [type drawInRect:NSMakeRect((imageSize.width-[type size].width)/2, imageSize.height-[type size].height, [type size].width, [type size].height) fromRect:NSMakeRect(0, 0, [type size].width, [type size].height) operation:NSCompositeSourceOver fraction:1.0]; [image unlockFocus]; NSBitmapImageRep *imageRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]]; NSData *iconData = [imageRep representationUsingType:NSPNGFileType properties:nil]; [iconData writeToFile:@/drawn.png automatcially:YES]; [image release]; [server release]; [pool drain]; return 0; } ___ 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
Re: Detecting system protected folders.
On 2009-12-18, at 3:25 PM, Greg Guerin wrote: Sandro Noël wrote: it does not work, even if i select the root folder of my hard drive i still get the permission to rename it. What effective user id is it running as? What groups is that user id a member of? Run this Terminal command to identify the user: id -p uid snoel groups staff _developer _lpoperator _lpadmin _appserveradm admin _appserverusr localaccounts everyone com.apple.access_screensharing Run this Terminal command to examine permissions: ls -ld / drwxrwxr-t 31 root admin 1122 18 Dec 20:32 / If the code isn't doing what you want, then please explain more precisely what you want to happen. Give examples. Well for instance if I try to rename the music folder in my personal home folder using Finder The system/finder will not let me do that because the folder is needed by the system. The cell never enters edit mode. I can however write to these folders as I am the owner I want to reproduce the same functionality. cheers, Sandro Noel.___ 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
Re: NSApplicationLoad() can't connect to window server in user logged out.
NSImage needs a connection to the Window Server in Leopard. If you want to do some offscreen headless rendering, use CoreGraphics + ImageIO On Sat, Dec 19, 2009 at 2:21 AM, Mr. Gecko grmrge...@gmail.com wrote: Ok, so I've done some more research and found this http://developer.apple.com/mac/library/technotes/tn2005/tn2083.html#SECPRELOGINANDTRUST, it basically says to run it in the loginwindow, but I can't do that with apache which is what I'm running my code with. Because this is a personal application I wouldn't mind doing things the hacking way and some how make the windowserver trust apache. On Dec 18, 2009, at 6:06 PM, Mr. Gecko wrote: Hello I'm running 10.5 and I'm trying to do some image drawing with NSImage in Terminal via SSH and it seems like every time I try, I get this error _RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL. 2009-12-18 17:54:04.963 weather.mgm[655:10b] *** -[NSRecursiveLock unlock]: lock (NSRecursiveLock: 0x121b30 '(null)') unlocked when not locked 2009-12-18 17:54:04.973 weather.mgm[655:10b] *** Break on _NSLockError() to debug. 2009-12-18 17:54:04.978 weather.mgm[655:10b] An uncaught exception was raised 2009-12-18 17:54:05.009 weather.mgm[655:10b] Error (1002) creating CGSWindow 2009-12-18 17:54:05.014 weather.mgm[655:10b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1002) creating CGSWindow' 2009-12-18 17:54:05.040 weather.mgm[655:10b] Stack: ( 2513718512, 2536973548, 2513718272, 2513718328, 2470748316, 2470747564, 2470746864, 2470746400, 2470743808, 2470755712, 2470754620, 2470754184, 2470743272, 8540 ) I know this code I'm using works as it runs perfectly fine on Snow Leopard via SSH but for some reason it doesn't work on Leopard, what could be wrong here? How can I get this working on Leopard? Basic code to this is int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSApplicationLoad(); NSImage *image = [[NSImage alloc] initWithContentsOfFile:@ /background.png]; NSSize imageSize = [image size]; [image lockFocus]; NSImage *type = [[NSImage alloc] initWithContentsOfFile:@ /icons/93x93/1.png]; [type drawInRect:NSMakeRect((imageSize.width-[type size].width)/2, imageSize.height-[type size].height, [type size].width, [type size].height) fromRect:NSMakeRect(0, 0, [type size].width, [type size].height) operation:NSCompositeSourceOver fraction:1.0]; [image unlockFocus]; NSBitmapImageRep *imageRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]]; NSData *iconData = [imageRep representationUsingType:NSPNGFileType properties:nil]; [iconData writeToFile:@/drawn.png automatcially:YES]; [image release]; [server release]; [pool drain]; return 0; } ___ 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/jjalon%40gmail.com This email sent to jja...@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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSApplicationLoad() can't connect to window server in user logged out.
Can I do exactly what I'm doing there in that? I also need to place some text in there which I have in the full code, just made my code shorter as an example. On Dec 18, 2009, at 8:07 PM, Julien Jalon wrote: NSImage needs a connection to the Window Server in Leopard. If you want to do some offscreen headless rendering, use CoreGraphics + ImageIO On Sat, Dec 19, 2009 at 2:21 AM, Mr. Gecko grmrge...@gmail.com wrote: Ok, so I've done some more research and found this http://developer.apple.com/mac/library/technotes/tn2005/tn2083.html#SECPRELOGINANDTRUST, it basically says to run it in the loginwindow, but I can't do that with apache which is what I'm running my code with. Because this is a personal application I wouldn't mind doing things the hacking way and some how make the windowserver trust apache. On Dec 18, 2009, at 6:06 PM, Mr. Gecko wrote: Hello I'm running 10.5 and I'm trying to do some image drawing with NSImage in Terminal via SSH and it seems like every time I try, I get this error _RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL. 2009-12-18 17:54:04.963 weather.mgm[655:10b] *** -[NSRecursiveLock unlock]: lock (NSRecursiveLock: 0x121b30 '(null)') unlocked when not locked 2009-12-18 17:54:04.973 weather.mgm[655:10b] *** Break on _NSLockError() to debug. 2009-12-18 17:54:04.978 weather.mgm[655:10b] An uncaught exception was raised 2009-12-18 17:54:05.009 weather.mgm[655:10b] Error (1002) creating CGSWindow 2009-12-18 17:54:05.014 weather.mgm[655:10b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1002) creating CGSWindow' 2009-12-18 17:54:05.040 weather.mgm[655:10b] Stack: ( 2513718512, 2536973548, 2513718272, 2513718328, 2470748316, 2470747564, 2470746864, 2470746400, 2470743808, 2470755712, 2470754620, 2470754184, 2470743272, 8540 ) I know this code I'm using works as it runs perfectly fine on Snow Leopard via SSH but for some reason it doesn't work on Leopard, what could be wrong here? How can I get this working on Leopard? Basic code to this is int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSApplicationLoad(); NSImage *image = [[NSImage alloc] initWithContentsOfFile:@/background.png]; NSSize imageSize = [image size]; [image lockFocus]; NSImage *type = [[NSImage alloc] initWithContentsOfFile:@/icons/93x93/1.png]; [type drawInRect:NSMakeRect((imageSize.width-[type size].width)/2, imageSize.height-[type size].height, [type size].width, [type size].height) fromRect:NSMakeRect(0, 0, [type size].width, [type size].height) operation:NSCompositeSourceOver fraction:1.0]; [image unlockFocus]; NSBitmapImageRep *imageRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]]; NSData *iconData = [imageRep representationUsingType:NSPNGFileType properties:nil]; [iconData writeToFile:@/drawn.png automatcially:YES]; [image release]; [server release]; [pool drain]; return 0; } ___ 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/jjalon%40gmail.com This email sent to jja...@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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Detecting system protected folders.
Sandro Noël wrote: Well for instance if I try to rename the music folder in my personal home folder using Finder The system/finder will not let me do that because the folder is needed by the system. Testing this in Terminal: mv ~/Music ~/lose I get a Permission denied error message, which suggests an ACL. It's confirmed by this command: ls -led ~/Music Based on this, my new guess is that NSFileManager isn't using the ACL to check for writability. You may want to look at other NSFileManager methods, or look into other ways to read the ACL. -- GG___ 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
Re: Undo Names in NSPersistentDocument
On 19/12/2009, at 12:08 PM, Gerriet M. Denkmann wrote: How would I do this? Subclass the NSArrayControllers and overrriding add: and remove: to call setActionName:? Or is there a simpler way? My take on this is this: The action name is part of the View layer (because it appears in the menu) but the add/remove are themselves part of the data model. So the action name is best set also by the controller that triggers the add/remove events in the data model. The typical pattern I use is this: - (IBAction) someAction:(id) sender { [myDataModel doSomethingUndoable]; // calls through to data model's -add: method which registers -remove: with the undo manager [[self undoManager] setActionName:[sender title]]; } This assumes that the sender has a title that is useful as an action name (a menu item, say) - if not just set it using NSLocalizedString(). Once a given undo group has an action name, that action name will stick to that group for future undos and redos without you having to set it up again - in fact you really don't want to change it during an undo or a redo, though you can if you want. So that's nice and straightforward with target/action, but with Bindings, maybe less so. You could subclass the controller but another way might be to observe changes purely for the purpose of registering a relevant action name, which would avoid that. I've done this by getting my observable data model classes to export an undo description string for each property that can be changed, so they supply something appropriate and localised. Unfortunately I haven't used Core Data so I'm not sure what's needed to fit in with that, if the framework hasn't already solved it. --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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSUndoManager auto-grouping?
On 19/12/2009, at 5:09 AM, Jerry Krinock wrote: I would be SOO HAPPY if Apple would just somehow let me have a teeny-tiny peek at the Undo Stack -- if only for debugging purposes. We don't even get a -count :( Yep, just the ability to peek at what's actually on the stacks is very helpful for debugging. Though in NSUndoManager's case there seem to be all sorts of odd private classes marking the start and end of groups, rather than just structuring groups into a tree, as I have. Great news that you've got it done -- and with actual documentation including Implementation Details! I'll let you know maybe next week if GCUndoManager is ready for Core Data. Or more accurately, is Core Data ready for and undo manager that implements its documented API, nothing more and nothing less? (Looking for a bigger hard drive to log all the expected exceptions...) Cool, that would be great to know. Don't forget it's Christmas though ;-) -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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Outline View CancelEditing
On 19/12/2009, at 3:32 AM, Sandro Noël wrote: I do not have access to the window instance. How do i get to the window? Yes you do - all views have a -window property that returns it. --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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Undo Names in NSPersistentDocument
On 19 Dec 2009, at 11:39, Graham Cox wrote: On 19/12/2009, at 12:08 PM, Gerriet M. Denkmann wrote: How would I do this? Subclass the NSArrayControllers and overrriding add: and remove: to call setActionName:? Or is there a simpler way? My take on this is this: The action name is part of the View layer (because it appears in the menu) but the add/remove are themselves part of the data model. So the action name is best set also by the controller that triggers the add/remove events in the data model. The typical pattern I use is this: - (IBAction) someAction:(id) sender { [myDataModel doSomethingUndoable]; // calls through to data model's -add: method which registers -remove: with the undo manager [[self undoManager] setActionName:[sender title]]; } Following your suggestion I added in MyDocument.m: - (IBAction)add: sender; { [ [ self undoManager ] setActionName: @Add ]; [ dictWordArrayController add: sender ]; } and now got two Undo items: 1. Undo Add (which does nothing) 2. Undo (without name, which undoes the add:) Same result for subclassing NSArrayController and overriding add: The documentation says: Beginning with Mac OS X v10.4 the result of this method is deferred until the next iteration of the runloop Setting a breakpoint on registerUndoWithTarget:selector:object: tell me that this is triggered by some internal method in NSArrayController. Now I don't have any more ideas how to set undo-names. I had a little more success with my TableViews: Setting the ActionName in the delegate method -controlTextDidEndEditing: works - somehow. The problem: this method is called regardless whether some change did occur or not. So if one double clicks a cell, then clicks somewhere else (or edits the content of the cell from A to B and back to A ) I get an empty Undo Edit LastName. Setting a flag in controlTextDidChange: is no real help, because it does not cover the A → B → A case. Without interfering with setActionName: one never gets empty undos. Maybe GCUndoManager could implement: - (void)setActionNameToBeUsedAtTheNextNonEmptyNamelessUndo: (NSString *)actionName; - or something like that with a slightly shorter name. Kind regards, 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSAlert or what?
Hi, Sorry for the really noob posting, but I am currently using the NSAlert class to display alerts in my application, but what I would rather do is display one of the alert boxes that slide out of the title bar, as with the installer, firefox and a slew of other applications. Does anyone know what I need to do to do this? Thanks for you time in advance! Mikey___ 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
Weird problem closing windows
Hi, I am experiencing a weird problem with my GC (if this is relevant) application when trying to re-display windows that are in the main xib file. More specifically, when I try to launch the preferences panel for the second time it hangs the window with even the close button disabled. Is there something really obvious I am missing with this? Thanks for your time, Mikey___ 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
Re: Undo Names in NSPersistentDocument
On 2009 Dec 18, at 21:34, Gerriet M. Denkmann wrote: I added in MyDocument.m: - (IBAction)add: sender; { [ [ self undoManager ] setActionName: @Add ]; [ dictWordArrayController add: sender ]; } and now got two Undo items: I presume you mean that you can click Undo once, and then the item is still enabled, so you click again. 1. Undo Add (which does nothing) 2. Undo (without name, which undoes the add:) Yes, it's a fairly well-known issue. Except, you imply that before you added this method, there was only one Undo click available. That's very interesting -- something I'd never noticed. It's as though setting the action name is being registered as an undoable action, and gets thrown on the Undo Stack. So maybe your does nothing is actually un-setting the action name ?!?!? I have a work in progress which solves this problem by beginning an undo grouping whenever a managed object changes, and the same method ends it automatically via performSelector:withObject:afterDelay:. The idea is that it swallows up whatever Core Data does into one super-undo-group. It works pretty good but I'm still ironing it out. For another solution, you should read this: http://wilshipley.com/blog/2007/12/transitions-and-epiphanies.html ___ 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
Re: NSAlert or what?
On Dec 19, 2009, at 12:37 AM, Michael Davey wrote: Sorry for the really noob posting, but I am currently using the NSAlert class to display alerts in my application, but what I would rather do is display one of the alert boxes that slide out of the title bar, as with the installer, firefox and a slew of other applications. Does anyone know what I need to do to do this? Those are called sheets. There are methods on NSAlert for displaying the alert as a sheet. Also, read the companion guides listed at the top of the class reference for NSAlert. Cheers, Ken ___ 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
Re: NSAlert or what?
Thanks for the pointer! On 19 Dec 2009, at 18:37, David A. Lyons wrote: Here's a recipe I discovered recently: Consult the Apple Human Interface Guidelines PDF [1], which sometimes has an Implementation section that tells you what classes, APIs, or constants to use. In this case, browsing for this section: Part III: Aqua Windows Dialogs Types of Dialogs and When to Use Them Sheets (Document-Modal Dialogs) ...reveals the key word sheet, which in NSAlert.h will lead you straight to -[NSAlert beginSheetModalForWindow:modalDelegate:didEndSelector:contextInfo:] In the old days, the HI Guidelines always left us to discover the appropriate implementation ourselves. I like the new Implementation sections a lot, though currently they seem to only exist for the various views and controls. [1] http://developer.apple.com/mac/library/DOCUMENTATION/UserExperience/Conceptual/AppleHIGuidelines/OSXHIGuidelines.pdf Cheers, --Dave On Dec 18, 2009, at 10:37 PM, Michael Davey wrote: Hi, Sorry for the really noob posting, but I am currently using the NSAlert class to display alerts in my application, but what I would rather do is display one of the alert boxes that slide out of the title bar, as with the installer, firefox and a slew of other applications. Does anyone know what I need to do to do this? Thanks for you time in advance! Mikey___ 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/dlyons%40lyons42.com This email sent to dly...@lyons42.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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSAlert or what?
So the problem I was having with my googling was that I was trying alert, popup and dialog - not sheet ;o) On 19 Dec 2009, at 18:41, Ken Thomases wrote: On Dec 19, 2009, at 12:37 AM, Michael Davey wrote: Sorry for the really noob posting, but I am currently using the NSAlert class to display alerts in my application, but what I would rather do is display one of the alert boxes that slide out of the title bar, as with the installer, firefox and a slew of other applications. Does anyone know what I need to do to do this? Those are called sheets. There are methods on NSAlert for displaying the alert as a sheet. Also, read the companion guides listed at the top of the class reference for NSAlert. Cheers, Ken ___ 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