Re: Uncaught exceptions not terminating my app
If you don't crash the app, you don't get the stack trace. No stack trace = no clue about what went wrong. And we do offer to save the user's work (in the NSExceptionHandler delegate) before we bail out. And the idea, obviously, is to fix the crashes in the next maintenance release. We have a regular release cycle. My experience is that users don't mind a few problems if they get prompt support and know that you are on the case, and if you are in a position to figure out what caused the crash you can often suggest a workaround, pro-tem. Paul Sanders. - Original Message - From: "Jens Alfke" To: "Paul Sanders" Cc: "Ken Thomases" ; Sent: Wednesday, January 27, 2010 7:27 PM Subject: Re: Uncaught exceptions not terminating my app On Jan 27, 2010, at 11:01 AM, Paul Sanders wrote: > My basic tenet is that I want to catch unexpected exceptions > and > terminate my app in a way that produces a crash report > containing a > proper stack trace. As a developer I understand your desire; but as a user, I would rather have your app pop up an error alert, than suddenly crash and lose my unsaved work. (In my experience, most uncaught exceptions will allow the app to keep limping along afterwards, enough to show an alert and let the user save and quit.) It wouldn't be too hard to integrate the unexpected-error alert with UKCrashReporter so that it can send the backtrace to you; then you get the best of both worlds. —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: Size of Core Animation Layer
Le 28 janv. 2010 à 08:43, K.Darcy Otto a écrit : > NSRect rect = NSRectFromCGRect([hitLayer frame]); > float width = rect.size.width; > > That is, it returns a width, but not the width in the current window > coordinates. Any ideas? Thanks. What do you mean by "not the width in the current window coordinates"? By definition, a width is coordinate independent, as long as your underlying metric space remains the same (thanks to Einstein). Vincent ___ 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: NSString category name collision?
On 27 Jan 2010, at 15:39, Sean McBride wrote: > On 1/27/10 11:27 AM, jonat...@mugginsoft.com said: > >> OBJC_PRINT_REPLACED_METHODS generates a lot of references to >> CoreFoundation/Quartz/OSA framework category replacements. > > Yes, for those of us outside Apple such messages are just noise. I > encourage you to file a dupe! :) This has been logged as ID 7586879. If a var was defined to log category collisions that occur just from code loaded from the app bundle then it would be of much more practical use in highlighting problems. Jonathan___ 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: 10.6 : Class xxx does not implement the 'NSWindowDelegate' protocol
Hello all. Well Im not expert , but I just wanted to say that I have many NSWindowControllers in my app build on 10.6 and I have no such a warnings, and I hadn't have the need to implement NSWindowDelegate either. Gustavo On Jan 28, 2010, at 3:24 AM, Graham Cox wrote: > > On 28/01/2010, at 1:20 PM, Peter C wrote: > >> I try to compile this code (snippet) for 10.6, ends up with error message, >> >> "Class SomeWinController does not implement the 'NSWindowDelegate' protocol" >> >> @interface SomeWinController : NSWindowController >> >> - (void) windowDidLoad >> { >> [[self window] setDelegate:self]; >> } >> >> At the moment target is set to compile for 32 bit for 10.5 and 64 bit for >> 10.6. I did some googling but no satisfactory answer. How do I fix this >> problem ? > > > In 10.6 many informal protocols became formal ones. So try this: > > @interface SomeWinController : NSWindowController > > ... > > > --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/gustavxcodepicora%40gmail.com > > This email sent to gustavxcodepic...@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: 10.6 : Class xxx does not implement the 'NSWindowDelegate' protocol
On 28/01/2010, at 9:56 PM, Gustavo Pizano wrote: > Well Im not expert , but I just wanted to say that I have many > NSWindowControllers in my app build on 10.6 and I have no such a warnings, > and I hadn't have the need to implement NSWindowDelegate either. OK, but have you attempted to set any of those window controllers as delegates of their own window? NSWindowController is not its window's delegate by default, nor does it automatically listen for the related notifications, and nor does it conform to the (new, formal) NSWindowDelegate protocol by default. So if you haven't attempted to do that, or implemented any NSWindowDelegate methods, there's no reason you would have had any warnings. --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: 10.6 : Class xxx does not implement the 'NSWindowDelegate' protocol
I see. thanks for the clarification. :D G. On Jan 28, 2010, at 12:39 PM, Graham Cox wrote: > > On 28/01/2010, at 9:56 PM, Gustavo Pizano wrote: > >> Well Im not expert , but I just wanted to say that I have many >> NSWindowControllers in my app build on 10.6 and I have no such a warnings, >> and I hadn't have the need to implement NSWindowDelegate either. > > > OK, but have you attempted to set any of those window controllers as > delegates of their own window? NSWindowController is not its window's > delegate by default, nor does it automatically listen for the related > notifications, and nor does it conform to the (new, formal) NSWindowDelegate > protocol by default. So if you haven't attempted to do that, or implemented > any NSWindowDelegate methods, there's no reason you would have had any > warnings. > > --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: 10.6 : Class xxx does not implement the 'NSWindowDelegate' protocol
On 28 Jan, 2010, at 7:39 PM, Graham Cox wrote: > > On 28/01/2010, at 9:56 PM, Gustavo Pizano wrote: > >> Well Im not expert , but I just wanted to say that I have many >> NSWindowControllers in my app build on 10.6 and I have no such a warnings, >> and I hadn't have the need to implement NSWindowDelegate either. > > > OK, but have you attempted to set any of those window controllers as > delegates of their own window? NSWindowController is not its window's > delegate by default, nor does it automatically listen for the related > notifications, and nor does it conform to the (new, formal) NSWindowDelegate > protocol by default. So if you haven't attempted to do that, or implemented > any NSWindowDelegate methods, there's no reason you would have had any > warnings. > > --Graham > > True, set delegates on own windows cause this compile error to appear. On other window controllers without delegate, have no such compile error. NSWindowDelegate solve my problems, 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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSKeyValueBindingCreation Leak
I have a binding creation memory leak. -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] (in AppKit) A custom object in a nib is wired to a NSArrayController. @interface CustomObject : NSObject { IBOutlet id arrayController; NSArray *array; } @end @implementation CustomObject - (void)awakeFromNib { [self bind:@"array" toObject:arrayController withKeyPath:@"arrangedObjects" options:nil]; [arrayController addObserver:self forKeyPath:@"arrangedObjects.changed" options:NSKeyValueObservingOptionNew context:self]; } - (void)dealloc { [arrayController removeObserver:self forKeyPath:@"arrangedObjects.changed"]; [self unbind:@"array"]; [super dealloc]; } @end Why am I leaking? --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: NSKeyValueBindingCreation Leak
On 28/01/2010, at 11:57 PM, Richard Somers wrote: > Why am I leaking? What's the evidence that you are? --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: NSKeyValueBindingCreation Leak
On Jan 28, 2010, at 6:03 AM, Graham Cox wrote: What's the evidence that you are? MallocDebug reports a leak, and the leak grow over time. ... -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] ... -[CustomObject awakeFromNib] ... NSApplicationMain start --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
Forcing menu update in 10.4?
Hi, I have a hierarchical menu that places checkmarks next to sub-menu items when the user selects an item. If either of the sub-menu items are checked, I would like the top-level item to be checked. This works, but the top-level item does not update until the mouse rolls over any of the top level items to force an update, so you don¹t see the change in state in the top-level items as soon as the menu appears after one of the sub-menu states has been changed. In 10.5, you can get the view of an NSMenuItem, and then call display to force an update, but I have not found a way in 10.4. Am I just out of luck? -- Michael Domino michael.dom...@identityfinder.com Phone: 617-816-5851 Identity Finder, LLC 250 West 57th St; Suite 1400 New York, NY 10107 http://www.identityfinder.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
Displaying animated content in iPhone app
I'm working on an iPhone application and I need some advice on displaying animated content (think: cartoon like movies). Hopefully someone can point me in the right direction. Goal The application needs to display short 2 second 'clips' of animated characters in a loop. Animation can be triggered by tapping the screen. Options --- - I've looked at AVFoundation, but it seems to be all 'A', no 'V'. - I've looked at MediaPlayer. The MPMoviePlayerController class however is very limited and doesn't offer features I would need. It takes over control of the screen/view. There is no access to the 'movie view', it assumes landscape playback so I need to rotate my content. etc. etc. - I've seen mentioned that movie playback inside a view is not currently supported in the frameworks. I've also not found support for movie file formats (you can only pass a url into the iPhone frameworks, that's it). Ultimately, the only approach left at this moment seems to be to create a movie playback view myself using Quartz? I really would like to forgo this if there is a way (or if there is existing code available). So, what are the current options for displaying movie like content in your app and have a decent control over playback and display? Thanks for any insight you can provide, patrick -- Patrick Machielse Hieper Software http://www.hieper.nl i...@hieper.nl ___ 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: Uncaught exceptions not terminating my app
> If you don't crash the app, you don't get the stack trace. No > stack trace = no clue about what went wrong. Just yesterday I was working on some new code, which threw an exception, and the logged message included the stack trace. Never seen that before, so I assume it's new in Snow Leopard. At this point I have no idea whether that's true for all exceptions or just certain types, and whether or not it requires the developer tools to be installed. But perhaps something to check into: examine logs for exceptions thrown by your app... -- 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
Hot to define a connection from source code?
Hello everybody, I'm new blind developer from Spain. Well, I can use interface builder to add objects to a window, define outlets and actions but I can define a connection between an outlet and an action. How can I do this in sourceCode using objetive-C? I searched it in my Objetive-C spanish documentation but all books use interface Builder method to do this. Where can I find an easy example code? thanks and regards Jonathan Chacón ___ 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: Displaying animated content in iPhone app
On Jan 28, 2010, at 8:22 AM, patrick machielse wrote: > I'm working on an iPhone application and I need some advice on displaying > animated content (think: cartoon like movies). Hopefully someone can point me > in the right direction. > > Goal > > The application needs to display short 2 second 'clips' of animated > characters in a loop. Animation can be triggered by tapping the screen. > > So, what are the current options for displaying movie like content in your > app and have a decent control over playback and display? > For simple "flipbook style" animation, you can load up all the frames as an array of UIImages and then use a UIImageView's animationImages to display them. Doesn't give you a whole lot of control (you basically get to set the frame rate, number of times to loop and the frames) but this approach works reasonable for handling things like animated GIFs (provided that you write the code to decode the GIF files into the frames you need). 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: Uncaught exceptions not terminating my app
Yes, I believe this is new in Snow Leopard. But on Leopard and Tiger, only numerical addresses are available and to interpret those requires that you know the 'slide' of each dylib loaded, which varies from machine to machine. Mind you, with the breathtaking speed of uptake of Snow Leopard, maybe that is good enough... Paul Sanders. - Original Message - From: "Scott Ribe" To: "Paul Sanders" Cc: Sent: Thursday, January 28, 2010 2:23 PM Subject: Re: Uncaught exceptions not terminating my app > If you don't crash the app, you don't get the stack trace. No > stack trace = no clue about what went wrong. Just yesterday I was working on some new code, which threw an exception, and the logged message included the stack trace. Never seen that before, so I assume it's new in Snow Leopard. At this point I have no idea whether that's true for all exceptions or just certain types, and whether or not it requires the developer tools to be installed. But perhaps something to check into: examine logs for exceptions thrown by your app... -- 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
how can i do the equivalent of "new email with selection" service?
how can i do the equivalent of "new email with selection" service from a cocoa app programmatically? ___ 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: Uncaught exceptions not terminating my app
On Jan 28, 2010, at 12:10 AM, Paul Sanders wrote: > If you don't crash the app, you don't get the stack trace. No > stack trace = no clue about what went wrong. That's why I said the error alert should include the same "Report" button as the crash report would. > And we do offer to > save the user's work (in the NSExceptionHandler delegate) before > we bail out. That's fairly dangerous. At that point you have no idea what's on the stack or what operations are halfway done. If you're doing inside a half-completed AppKit or HLTB call, putting up any UI creates re-entrant calls. If you're inside your own code, you're calling yourself re-entrantly when you save. It's safer to save away the exception info, let the stack unwind fully, and then on the next runloop cycle put up the alert: http://bitbucket.org/snej/myutilities/src/tip/ExceptionUtils.m —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: Hot to define a connection from source code?
On Jan 28, 2010, at 6:38 AM, Jonathan Chacón wrote: > I can use interface builder to add objects to a window, define outlets and > actions but I can define a connection between an outlet and an action. How > can I do this in sourceCode using objetive-C? To set an outlet, just set the instance variable or property of the source object. To set an action, call [sourceObject setTarget: myTarget] and [sourceObject setAction: @selector(myAction:)]. —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: Forcing menu update in 10.4?
On Jan 28, 2010, at 5:52 AM, Michael Domino wrote: > I have a hierarchical menu that places checkmarks next to sub-menu items > when the user selects an item. If either of the sub-menu items are checked, > I would like the top-level item to be checked. This works, but the top-level > item does not update until the mouse rolls over any of the top level items > to force an update It sounds like you're trying to update the checked state during menu tracking. Don't do that. Instead, implement the UI validation protocol (-validateUserInterfaceItem:), and when asked to validate a particular action, set the 'selected' state of the menu item being validated. —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: NSKeyValueBindingCreation Leak
On Jan 28, 2010, at 5:13 AM, Richard Somers wrote: MallocDebug reports a leak, and the leak grow over time. If you never unbind, you're probably just seeing the KVO bookkeeping taking place. Alternatively, you're calling super's implementation of - bind:toObject:withKeyPath:options: from within your own, but not calling super's implementation of unbind:. Due to KVB's (and KVO's) pretty poor API design, correctly dealing with superclass observers is impossible. If your class implements a certain binding, it should not allow super to do so as well. --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
NSSlider
I cannot discern a method that tracks the knob on and NSSlider. Is it possible to track an NSSlider? -db ___ 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: NSSlider
On Jan 28, 2010, at 9:05 AM, David Blanton wrote: > I cannot discern a method that tracks the knob on and NSSlider. Check the "continuous" checkbox in IB (or set the object property of the same name) and your target will get called while the user drags, as soon as the position changes. —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: NSSlider
Le 28 janv. 2010 à 18:05, David Blanton a écrit : > I cannot discern a method that tracks the knob on and NSSlider. > > Is it possible to track an NSSlider? Binds "value" to some KVC variable of your tracking object, no? Vincent___ 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
Which CA Layer am I dragging over?
On 28-Jan-10, at 2:47 AM, vincent habchi wrote: Le 28 janv. 2010 à 08:43, K.Darcy Otto a écrit : NSRect rect = NSRectFromCGRect([hitLayer frame]); float width = rect.size.width; That is, it returns a width, but not the width in the current window coordinates. Any ideas? Thanks. What do you mean by "not the width in the current window coordinates"? By definition, a width is coordinate independent, as long as your underlying metric space remains the same (thanks to Einstein). Vincent Maybe I'm going at this the wrong way. I've got a bunch of CA layers with images, and I'm dragging with the mouse. The question I would like to answer is: which CA layer is the mouse currently being dragged over? The solution I am pursuing is as follows: 1. From -mouseDragged, set up a series of NSTrackingAreas that correspond to each CA layer that I'm interested in. 2. The NSTrackingAreas will trigger -mouseEntered and -mouseExited for the CA layers 3. Use the NSEvent data from -mouseEntered to determine the current screen position and -hitTest to determine layer The problem is that I'm having difficulty setting up the NSTrackingAreas. Given CA layer x, I want to discover the position of x in the window so I can set up the tracking area. Is this the right way to solve this problem? If so, how do I get the rect for layer x?___ 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: Displaying animated content in iPhone app
On Jan 28, 2010, at 6:22 AM, patrick machielse wrote: > - I've seen mentioned that movie playback inside a view is not currently > supported in the frameworks. I've also not found support for movie file > formats (you can only pass a url into the iPhone frameworks, that's it). Keep in mind that a URL can point to a local file too. > Ultimately, the only approach left at this moment seems to be to create a > movie playback view myself using Quartz? I really would like to forgo this if > there is a way (or if there is existing code available). > > So, what are the current options for displaying movie like content in your > app and have a decent control over playback and display? As Glenn mentioned there is the UIImageView's animationImages property. You can gain more control by dropping down to the Core Animation level as well. And there is always OpenGL ES. -- 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: Which CA Layer am I dragging over?
On Jan 28, 2010, at 9:26 AM, K. Darcy Otto wrote: > The problem is that I'm having difficulty setting up the NSTrackingAreas. > Given CA layer x, I want to discover the position of x in the window so I can > set up the tracking area. Is this the right way to solve this problem? If > so, how do I get the rect for layer x? NSRectFromCGRect() is basically just a typecast, but you need a coordinate conversion. The way to do this is to first convert the bounds of layer X to a rectangle in the coordinate system of your view's layer, which can be done with -convertRect:fromLayer: (note, you want bounds NOT frame here – if you use frame you need to convert from layer x's superlayer because the frame is in the layer' superlayer's coordinate system). Overall you may find it easier to simply setup a tracking area for the entire view and then hit test to find the layer of interest instead, especially since moving the layers around would mean moving the tracking areas around too. -- 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: NSSlider
> On Jan 28, 2010, at 9:05 AM, David Blanton wrote: > >> I cannot discern a method that tracks the knob on and NSSlider. > > Check the "continuous" checkbox in IB (or set the object property of the same > name) and your target will get called while the user drags, as soon as the > position changes. Do not forget there are some pitfalls. For example, I bound a slider to the alpha value of a CALayer. I had to subclass it, because there is no way I found (except a custom NSValueTransformer) to get the slider return a float value from [0,1] instead of integers. Vincent___ 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: NSKeyValueBindingCreation Leak
On Jan 28, 2010, at 04:57, Richard Somers wrote: > - (void)awakeFromNib > { >[self bind:@"array" > toObject:arrayController > withKeyPath:@"arrangedObjects" > options:nil]; > >[arrayController addObserver:self > forKeyPath:@"arrangedObjects.changed" > options:NSKeyValueObservingOptionNew > context:self]; > } Could you maybe say what you're trying to do here? As is, this code looks completely and utterly wrong. "array" is an instance variable (and, by default, perhaps a property, but it's not a binding, AND the direction of the dependency looks unlikely. "arrangedObjects.changed" doesn't look like something you can observe. Maybe there is more code elsewhere that clarifies this. Did you check the log for exception messages? ___ 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: Forcing menu update in 10.4?
Thanks for replying! No, what happens is: 1. the user selects a sub-menu item, and item is checked or unchecked. 2. The menu closes. 3. The user selects the menu again, and keeps the mouse on the main menu title. The top-level item is not updated to its true state (either checked or unchecked) which had been set in the previous menu selection, until the mouse rolls down over the menu items. The state has been changed in the previous menu selection, the menu has closed, and then when it's reopened the state has not been updated. Is that clearer? On 1/28/10 11:37 AM, "Jens Alfke" wrote: > > On Jan 28, 2010, at 5:52 AM, Michael Domino wrote: > >> I have a hierarchical menu that places checkmarks next to sub-menu items >> when the user selects an item. If either of the sub-menu items are checked, >> I would like the top-level item to be checked. This works, but the top-level >> item does not update until the mouse rolls over any of the top level items >> to force an update > > It sounds like you're trying to update the checked state during menu tracking. > Don't do that. Instead, implement the UI validation protocol > (-validateUserInterfaceItem:), and when asked to validate a particular action, > set the 'selected' state of the menu item being validated. > > Jens > -- Michael Domino michael.dom...@identityfinder.com Phone: 617-816-5851 Identity Finder, LLC 250 West 57th St; Suite 1400 New York, NY 10107 http://www.identityfinder.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: Uncaught exceptions not terminating my app
- Original Message - From: "Jens Alfke" To: "Paul Sanders" Cc: "Ken Thomases" ; Sent: Thursday, January 28, 2010 4:34 PM Subject: Re: Uncaught exceptions not terminating my app On Jan 28, 2010, at 12:10 AM, Paul Sanders wrote: >> If you don't crash the app, you don't get the stack trace. No >> stack trace = no clue about what went wrong. > That's why I said the error alert should include the same "Report" button as > the crash > report would. A symbolic stack trace is only available on Snow Leopard. We also support Leopard and Tiger. And a numeric stack trace can only be interpreted if you have the slides of the loaded dylibs. I don't know how to get hold of those at runtime ... >> And we do offer to >> save the user's work (in the NSExceptionHandler delegate) before >> we bail out. >That's fairly dangerous. At that point you have no idea what's on the stack or >what >operations are halfway done. If you're doing inside a half-completed >AppKit or HLTB call, >putting up any UI creates re-entrant calls. If you're >inside your own code, you're calling >yourself re-entrantly when you save. >It's safer to save away the exception info, let the stack unwind fully, and >then on the next >runloop cycle put up the alert: >http://bitbucket.org/snej/myutilities/src/tip/ExceptionUtils.m No more dangerous then doing a random longjmp back to the event loop, which is what happens if you let the exception unwind. As I say, the frameworks do not appear to use exception handling internally, other than to get back to the event loop in this way. If they did, what I am doing would be a disaster. Thanks for the link but it is out of date. atos is no longer supplied in the retail distribution, as of Leopard. Madness, no? But as Scott already pointed out, Snow Leopard's [NSException callStackSymbols] method offers a viable alternative for reporting a complete symbolic stack trace yourself if your app is Snow Leopard only, so if you are philosophically opposed to crashing your app when something bad has happened (which I am not) then that might be preferable. ___ 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: Hot to define a connection from source code?
Hello, thanks for your help but I don't know where I have to define de connection between outleets and actions. I have to type them in the appController, windowDelegate or where the outlets were defined? I have to type the connection in a function/method of a class or like a variable or outleet in the declaration area of a class? sorry but I'm newbie in Cocoa and Objetive-C thanks and regards Jonathan Chacón El 28/01/2010, a las 17:36, Jens Alfke escribió: > > On Jan 28, 2010, at 6:38 AM, Jonathan Chacón wrote: > >> I can use interface builder to add objects to a window, define outlets and >> actions but I can define a connection between an outlet and an action. How >> can I do this in sourceCode using objetive-C? > > To set an outlet, just set the instance variable or property of the source > object. > > To set an action, call [sourceObject setTarget: myTarget] and [sourceObject > setAction: @selector(myAction:)]. > > —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: NSSlider
Continuous Check Box did the trick .. Thanks! -db On Jan 28, 2010, at 10:11 AM, Jens Alfke wrote: On Jan 28, 2010, at 9:05 AM, David Blanton wrote: I cannot discern a method that tracks the knob on and NSSlider. Check the "continuous" checkbox in IB (or set the object property of the same name) and your target will get called while the user drags, as soon as the position changes. —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: CALayer maybe silly question
On Jan 27, 2010, at 9:52 PM, vincent habchi wrote: >> But at the same time, you could probably simplify this a lot by creating >> CGImages with your content and then assign those images as the contents of >> your layers from the main thread. This is almost certainly likely to be >> simpler and less error prone (as well as allowing for a cleaner handoff of >> content). > > The problem is one of smoothness. One of the layers I want to display has > more than 1,500,000 points. If I try to display it on the main thread, I get > the wheel, because everything above 100,000 points (CGArcs) takes a few > seconds to be rendered (the whole 1,500,000 set is redrawn in about 20 > seconds, and that includes decoding PostGIS HexEWKT geometry format). The > goal was to delegate display to secondary threads so that I can keep > scrolling and interacting even while refreshing large datasets like the one I > cited. You can create the images on a secondary thread, then pass them back to the main thread for assignment. The heavy operation is the drawing, not the uploading of drawn content. You may also want to consider culling some of that data before you draw it. -- 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: NSSlider
On Jan 28, 2010, at 9:42 am, vincent habchi wrote: >> Check the "continuous" checkbox in IB (or set the object property of the >> same name) and your target will get called while the user drags, as soon as >> the position changes. > > Do not forget there are some pitfalls. For example, I bound a slider to the > alpha value of a CALayer. I had to subclass it, because there is no way I > found (except a custom NSValueTransformer) to get the slider return a float > value from [0,1] instead of integers. > A trivial test setting the limits of a slider's value to 0 and 1 and binding its 'value' to an object controller shows that the slider happily sends float values between 0 and 1... mmalc ___ 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: Forcing menu update in 10.4?
On Jan 28, 2010, at 9:50 AM, Michael Domino > wrote: Is that clearer? Yes. It's even clearer now that you should be implementing the UI validation protocol. ;-) --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: NSSlider
On Jan 28, 2010, at 9:42 AM, vincent habchi wrote: Do not forget there are some pitfalls. For example, I bound a slider to the alpha value of a CALayer. I had to subclass it, because there is no way I found (except a custom NSValueTransformer) to get the slider return a float value from [0,1] instead of integers. Isn't that the perfect case for a value transformer? Why would you instead subclass NSSlider when a much simpler infrastructure already exists? --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: how can i do the equivalent of "new email with selection" service?
On 2010 Jan 28, at 07:34, Stephane Huaulme wrote: > how can i do the equivalent of "new email with selection" service from a > cocoa app programmatically? As far as the "selection", if you mean from your app, you're going to have to answer that for yourself. If you mean from another app, I don't know but you'll probably find out when you learn the answer to the next question. As far as creating a "service", if you mean something in the Services ▸ menu, you're going to have to find and read the basic documentation on that yourself. As far as creating an email message, use something like this: + (void)emailTo:(NSString*)address subject:(NSString*)subject body:(NSString*)body { NSString* mailtoString = [NSString stringWithFormat:@"mailto:%...@?subject=%@&body=%@";, (NSString*)[(NSString*)CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)address, NULL, CFSTR("&"), kCFStringEncodingUTF8) autorelease], (NSString*)[(NSString*)CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)subject, NULL, CFSTR("&"), kCFStringEncodingUTF8) autorelease], (NSString*)[(NSString*)CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)body, NULL, CFSTR("&"), kCFStringEncodingUTF8) autorelease]] ; // Create an email message in user's default email client NSURL* mailtoURL = [NSURL URLWithString:mailtoString] ; [[NSWorkspace sharedWorkspace] openURL:mailtoURL] ; } ___ 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: Which CA Layer am I dragging over?
On 28-Jan-10, at 9:38 AM, David Duncan wrote: On Jan 28, 2010, at 9:26 AM, K. Darcy Otto wrote: The problem is that I'm having difficulty setting up the NSTrackingAreas. Given CA layer x, I want to discover the position of x in the window so I can set up the tracking area. Is this the right way to solve this problem? If so, how do I get the rect for layer x? NSRectFromCGRect() is basically just a typecast, but you need a coordinate conversion. The way to do this is to first convert the bounds of layer X to a rectangle in the coordinate system of your view's layer, which can be done with -convertRect:fromLayer: (note, you want bounds NOT frame here – if you use frame you need to convert from layer x's superlayer because the frame is in the layer' superlayer's coordinate system). Thank you for this; but I'm still having a few problems. Here's what I have as part of -mouseDragged (where hitLayer is the CA layer that has been identified): CGRect p,q; p = [hitLayer bounds]; q = [[hitLayer superlayer] convertRect:p fromLayer:hitLayer]; Now, q is in the coordinate system of the superlayer - I'm not sure how to get it into the coordinate system of the view (there is no - convertRect:fromLayer: for the view). I've tried the NSView methods - convertRect:toView: and -convertRectToBase: without success. Overall you may find it easier to simply setup a tracking area for the entire view and then hit test to find the layer of interest instead, especially since moving the layers around would mean moving the tracking areas around too. Yes, I think this will be my fallback position. I actually have only a few areas that need to be tracked and only at certain times, which is why I'm trying with a series of NSTrackingArea first. 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
Fuzzy Focus Ring
Hi, everyone. I'm embarking on the creation of my first custom control, which will be basically like an NSSlider, but have more than one knob. To illustrate what I need it for, let's use a handy Star Trek analogy. Say Mr. Scott is in the Enterprise engine room. He has 20 units of power to distribute among four systems: Life Support, Propulsion, Weapons, and Shields. His power routing display might include a control like my own: A vertical slider with one knob each for the four systems. By dragging one of the knobs up or down, Scotty can adjust the amount of power routed to the system. The control would never let the distribution add up to more than 20 units, but any or all system could be assigned zero units. I guess the control is like a pie chart with an extra slice (for unassigned units) that the slices have been lined up vertically and squashed into a straight line. Anyway, when a knob is selected with the mouse or by tabbing to it, I'd like the active knob to have a nice, fuzzy focus ring, just like a normal Aqua control. And it should appear blue or graphite color according to the user's preference setting. Considering that the knob will probably be oddly shaped, how do I get the system to draw the focus ring? Is the system focus ring something you can just add to any graphic? ___ 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: Uncaught exceptions not terminating my app
On Jan 28, 2010, at 9:53 AM, Paul Sanders wrote: No more dangerous then doing a random longjmp back to the event loop, which is what happens if you let the exception unwind. As I say, the frameworks do not appear to use exception handling internally, other than to get back to the event loop in this way. There are various places in the frameworks where exceptions get caught and (mostly) ignored. Some of these are where Carbon code (like the menu or open/save file panel implementation) calls into Cocoa, since throwing an exception out through Carbon is bad news. (The Carbon examples may not be true anymore in 10.6, but they are in 10.5 and earlier.) —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: Hot to define a connection from source code?
On Jan 28, 2010, at 9:52 AM, Jonathan Chacón wrote: thanks for your help but I don't know where I have to define de connection between outleets and actions. I have to type them in the appController, windowDelegate or where the outlets were defined? I have to type the connection in a function/method of a class or like a variable or outleet in the declaration area of a class? I'm not sure I understand the question. You already know when you want to set a connection in code, right? You're writing out your logic and come to "ok, now I need to connect button b to my bPressed: method." So put the calls there. —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: Hot to define a connection from source code?
Le 28 janv. 2010 à 19:57, Jens Alfke a écrit : > > On Jan 28, 2010, at 9:52 AM, Jonathan Chacón wrote: > >> thanks for your help but I don't know where I have to define de connection >> between outleets and actions. I have to type them in the appController, >> windowDelegate or where the outlets were defined? >> >> I have to type the connection in a function/method of a class or like a >> variable or outleet in the declaration area of a class? > > I'm not sure I understand the question. You already know when you want to set > a connection in code, right? You're writing out your logic and come to "ok, > now I need to connect button b to my bPressed: method." So put the calls > there. Binding action is easy (call setTarget: setAction: on your Outlet in awakeFromNib), but how do you connect your outlet to your controller (so it is initialized at nib load time) ? I don't know any way to do it but in Interface Builder and unfortunately I don't see how to bind the outlet without mouse (but maybe someone has an idea). -- 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: NSKeyValueBindingCreation Leak
On Jan 28, 2010, at 10:45 AM, Quincey Morris wrote: Could you maybe say what you're trying to do here? As is, this code looks completely and utterly wrong. "array" is an instance variable (and, by default, perhaps a property, but it's not a binding, AND the direction of the dependency looks unlikely. "arrangedObjects.changed" doesn't look like something you can observe. Maybe there is more code elsewhere that clarifies this. Actually that is about all there is (and it works except for the leak). I started with Malcolm Crawford's "Graphics Bindings" example. It is the most complex programmatic example he has but just so happened to be the one that fit my need. I got hopelessly lost trying to understand the code and just started tossing things until I got down to a level that I could start to comprehend what was going on. http://homepage.mac.com/mmalc/CocoaExamples/controllers.html Programmatic bindings can be simplified. For example refer to "Implementing Your Own Cocoa Bindings" by Tom Dalling. www.tomdalling.com/cocoa/implementing-your-own-cocoa-bindings Any way it is true that "array" is an instance variable of the CustomObject which is bound to a NSArrayController. The purpose of the binding is to iterate over arrangedObjects like this. for (id foo in array) { // each foo do your thing } Also the "arrangedObjects.changed" observation of each foo does work. Did you check the log for exception messages? None. But I did just discover if I comment out the [self unbind:@"array"]; line then I get no leak. So the behavior is just opposite of what it should be. --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
NSSavePanel and file extensions
Hi, I run an NSSavePanel, and [dlg setCanSelectHiddenExtension:NO] is called on it. Running on Leopard, the extensions in the file browser list are always shown, and when a file is selected from the list the entire filename is copied to the text edit field at the top of the dialog, including the extension (which is what I want). Running on Snow Leopard, the extensions still appear in the file browser list, but when a file is selected the extension is not copied to the text edit field along with the rest of the filename. Is this a bug, or a feature? Thanks, Michael -- Michael Domino michael.dom...@identityfinder.com Phone: 617-816-5851 Identity Finder, LLC 250 West 57th St; Suite 1400 New York, NY 10107 http://www.identityfinder.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: NSSlider
Le 28 janv. 2010 à 19:30, mmalc Crawford a écrit : > > On Jan 28, 2010, at 9:42 am, vincent habchi wrote: > >>> Check the "continuous" checkbox in IB (or set the object property of the >>> same name) and your target will get called while the user drags, as soon as >>> the position changes. >> >> Do not forget there are some pitfalls. For example, I bound a slider to the >> alpha value of a CALayer. I had to subclass it, because there is no way I >> found (except a custom NSValueTransformer) to get the slider return a float >> value from [0,1] instead of integers. >> > A trivial test setting the limits of a slider's value to 0 and 1 and binding > its 'value' to an object controller shows that the slider happily sends float > values between 0 and 1... Geez. I got a binary behavior when I tested it: 0 except at the rightmost position. I'll try again. Thanks for the hint. Vincent___ 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: Uncaught exceptions not terminating my app
Yes, I think I came across one of those in the Carbon menu stuff as I reported in my original post. But I don't think that is relevant. As I say, I silently ignore those very few exceptions that the frameworks do occasionally throw in the absence of any error in my own code, and I have formed the distinct impression that these are only thrown as an oversight. Or, if you prefer, a bug. I should probably report them. They seem to be messages sent to types of NSEvent object that do not understand them. Paul Sanders. - Original Message - From: "Jens Alfke" To: "Paul Sanders" Cc: "Ken Thomases" ; Sent: Thursday, January 28, 2010 6:55 PM Subject: Re: Uncaught exceptions not terminating my app There are various places in the frameworks where exceptions get caught and (mostly) ignored. Some of these are where Carbon code (like the menu or open/save file panel implementation) calls into Cocoa, since throwing an exception out through Carbon is bad news. (The Carbon examples may not be true anymore in 10.6, but they are in 10.5 and earlier.) ___ 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: Uncaught exceptions not terminating my app
On 28 Jan 2010, at 18:55, Jens Alfke wrote: >> > > There are various places in the frameworks where exceptions get caught and > (mostly) ignored. Some of these are where Carbon code (like the menu or > open/save file panel implementation) calls into Cocoa, since throwing an > exception out through Carbon is bad news. > > (The Carbon examples may not be true anymore in 10.6, but they are in 10.5 > and earlier.) > On 10.6 exceptions generated in Carbon menu event dispatch are logged but ignored. eg:HIToolbox: ignoring exception 'window context is nil' that raised inside Carbon event dispatch Regards Jonathan Mitchell Developer http://www.mugginsoft.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: Uncaught exceptions not terminating my app
OK, thanks. I'll do a bit more testing on Snow Leopard. But I have code out in the field with my 'brutal' exception handling in place and nothing like this has ever (yet!) been reported. Paul Sanders. - Original Message - From: To: Sent: Thursday, January 28, 2010 7:38 PM Subject: Re: Uncaught exceptions not terminating my app On 28 Jan 2010, at 18:55, Jens Alfke wrote: >> > > There are various places in the frameworks where exceptions > get caught and (mostly) ignored. Some of these are where > Carbon code (like the menu or open/save file panel > implementation) calls into Cocoa, since throwing an exception > out through Carbon is bad news. > > (The Carbon examples may not be true anymore in 10.6, but they > are in 10.5 and earlier.) > On 10.6 exceptions generated in Carbon menu event dispatch are logged but ignored. eg:HIToolbox: ignoring exception 'window context is nil' that raised inside Carbon event dispatch ___ 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: Which CA Layer am I dragging over?
On Jan 28, 2010, at 10:39 AM, K. Darcy Otto wrote: > Thank you for this; but I'm still having a few problems. Here's what I have > as part of -mouseDragged (where hitLayer is the CA layer that has been > identified): > > CGRect p,q; > p = [hitLayer bounds]; > q = [[hitLayer superlayer] convertRect:p fromLayer:hitLayer]; > > Now, q is in the coordinate system of the superlayer - I'm not sure how to > get it into the coordinate system of the view (there is no > -convertRect:fromLayer: for the view). I've tried the NSView methods > -convertRect:toView: and -convertRectToBase: without success. The view's layer shares a coordinate system with the view (this assumes that view.frame.size == view.bounds.size). Therefore, once you've converted to the view's layer's coordinate system, you are in the view's internal (bounds) coordinate system. When view.frame.size != view.bounds.size this is trickier, but that is an unusual case for layer backing, and I don't think it is your case. -- 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: Fuzzy Focus Ring
On 2010 Jan 28, at 10:51, Charles Jenkins wrote: > I'd like the active knob to have a nice, fuzzy focus ring, just like a normal > Aqua control. And it should appear blue or graphite color according to the > user's preference setting. So, just to be clear, you don't want a Fuzzy Focus Ring. You want a Normal Focus Ring. Normal Focus Rings are fuzzy. > Considering that the knob will probably be oddly shaped, how do I get the > system to draw the focus ring? Is the system focus ring something you can > just add to any graphic? Not that I know of. The only way I've ever seen it done is to trace, or as they say "stroke" the path outlining the control. To do that, you'll need to describe the outline of your control as a bezier path. Here's a subclass of NSView which I use to draw focus rings. Drawing in Cocoa is kind of weird; be prepared to suspend disbelief. The drawing is done by the NSFrameRect() function, which won't work for you because it only draws rectangles. Instead, you'll need to define a bezier path and then "stroke" it. Oh, it looks like you can eliminated most of the code below if you're targetting Mac OS 10.5+. #import @interface NSView (FocusRing) - (void)patchPreLeopardFocusRingDrawingForScrolling ; - (void)drawFocusRing ; // Although the above method invokes -lockFocus, and thus will work if // invoked while not within -drawRect, it is recommended to invoke this // method from within -drawRect, to avoid the possibility of a // later invocation of -drawRect by Cocoa for some other purpose, which it // does frequently, will wipe out the focus ring that has just been drawn. // This can happen even before the focus ring has a chance to show! @end @implementation NSView (FocusRing) // Invoke the following metod during -awakeFromNib - (void)patchPreLeopardFocusRingDrawingForScrolling { if (NSAppKitVersionNumber < 900) { // In Tiger and Panther, the remnants of the focus ring will stay // on screen as the view is scrolled. The following patch fixes that: NSView* clipView = self; while((clipView = [clipView superview]) != nil) { if([clipView isKindOfClass:[NSClipView class]]) break ; } [(NSClipView*)clipView setCopiesOnScroll:NO] ; } } - (void)drawFocusRing { [self lockFocus] ; // Needed in case we were not invoked from within drawRect: [[NSColor keyboardFocusIndicatorColor] set]; NSRect rect = [self visibleRect] ; [NSGraphicsContext saveGraphicsState]; NSSetFocusRingStyle(NSFocusRingOnly); NSFrameRect(rect); [NSGraphicsContext restoreGraphicsState]; // The above code is from: // http://www.cocoabuilder.com/archive/message/cocoa/2003/4/7/88648 // The remainder of that message applies to pre-Leopard only // and is implemented in this class' -patchPreLeopardFocusRingDrawingForScrolling. [self unlockFocus] ; // Balance lockFocus } @end ___ 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: CALayer maybe silly question
David, > You can create the images on a secondary thread, then pass them back to the > main thread for assignment. The heavy operation is the drawing, not the > uploading of drawn content. You may also want to consider culling some of > that data before you draw it. You're right. Up to that point, I'm quite satisfied with generating the contents directly out of the delegate, but, in a sense, your approach is more unified, since the same layer could then display either vector (drawn out of the database) or raster contents. Also, there is no possibility to make the drawing be continuous? At that point, the tiles pop out of the void when the drawing is over. No way to make the drawing dynamic? Thanks, Vincent ___ 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: NSSavePanel and file extensions
On 2010 Jan 28, at 11:26, Michael Domino wrote: > Running on Snow Leopard, the extensions still appear in the file browser > list, but when a file is selected the extension is not copied to the text > edit field along with the rest of the filename. When you find differences running in different Mac OS X versions, check the relevant release notes. In this case: http://developer.apple.com/mac/library/releasenotes/Cocoa/AppKit.html Note the section named "NSSavePanel / NSOpenPanel - General Updates (Updated since WWDC 2008)" ___ 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: Fuzzy Focus Ring
Le 28 janv. 2010 à 19:51, Charles Jenkins a écrit : > Considering that the knob will probably be oddly shaped, how do I get the > system to draw the focus ring? Is the system focus ring something you can > just add to any graphic? No, but maybe you can back the drawing of your control by a small CALayer, and then specify some kind of background colored shadow when it becomes the active responder? If it works, you gain extra control on border width, color and blur. Vincent___ 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: CALayer maybe silly question
On Jan 28, 2010, at 12:29 PM, vincent habchi wrote: > You're right. Up to that point, I'm quite satisfied with generating the > contents directly out of the delegate, but, in a sense, your approach is more > unified, since the same layer could then display either vector (drawn out of > the database) or raster contents. The content you are drawing is raster content, it doesn't matter that you are using -drawLayer:inContext: or assigning an image to the contents field, in either case you are getting raster content. > Also, there is no possibility to make the drawing be continuous? At that > point, the tiles pop out of the void when the drawing is over. No way to make > the drawing dynamic? If you mean to see the drawing as it progresses, you will need to manage that yourself. You would likely want to completely overhaul your rendering process to do it however, as using a small fixed number of tiles would make this very slow as you would end up needing to respecify content you've already specified (basically draw-upload-draw-upload). -- 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: CALayer maybe silly question
Le 28 janv. 2010 à 21:37, David Duncan a écrit : > On Jan 28, 2010, at 12:29 PM, vincent habchi wrote: > >> You're right. Up to that point, I'm quite satisfied with generating the >> contents directly out of the delegate, but, in a sense, your approach is >> more unified, since the same layer could then display either vector (drawn >> out of the database) or raster contents. > > The content you are drawing is raster content, it doesn't matter that you are > using -drawLayer:inContext: or assigning an image to the contents field, in > either case you are getting raster content. Of course. But then, admitting I do indeed draw offscreen and then load contents in the CALayer, on what object shall I draw? A CGLayer? Something else? > If you mean to see the drawing as it progresses, you will need to manage that > yourself. You would likely want to completely overhaul your rendering process > to do it however, as using a small fixed number of tiles would make this very > slow as you would end up needing to respecify content you've already > specified (basically draw-upload-draw-upload). The trick would obviously be drawing offscreen and then fire a timer each second or so to upload content until the full drawing is done. Why not? Have a very nice day, our is over. Cheers Vincent___ 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
IKImageBrowserView drop operation always highlighting a specific row
Hey guys, first off thank you for your time, I really appreciate it! So I am having problems with the drag'n'drop of the IKImageBrowserView. In my case I am dragging a file to the view which is automatically sorted case insensitive which means the user isn't able to re-arrange objects in it which is fine. It's more like a graphical confusion since the view always highlights an index to be dropped on but this isn't the case since it's automatically rearranging itself so what's required is a highlight of the entire view, not an index. I'd say I am looking for this NSTableView method for the IKImageBrowserView: setDropRow:dropOperation:… the docs say 'Passing a value of -1 for a row and NSTableViewDropOn as the operation causes the entire table view to hightlighted rather than a specific row'. That's exactly what I am looking for. If there's a way to disable the entire blue selection rectangle, I'd be fine with it too, it's just that I didn't find any way yet and all demos on the net are letting the user sort the view. I hope you understand what I am having problems with. Thanks and best regards, Tobias___ 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: Hot to define a connection from source code?
On Jan 28, 2010, at 11:05 AM, Jean-Daniel Dupas wrote: I don't know any way to do it but in Interface Builder and unfortunately I don't see how to bind the outlet without mouse (but maybe someone has an idea). Oh! Sorry, Jonathan, I overlooked the word "blind" in your original message. I didn't realize this is an accessibility issue. I don't know how to set up outlets and actions in Interface Builder without control-dragging, and I can see how that would be a problem. You should ask on the xcode-users mailing list, which is really for all the GUI development tools including IB. —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: CALayer maybe silly question
On Jan 28, 2010, at 12:48 PM, vincent habchi wrote: > Of course. But then, admitting I do indeed draw offscreen and then load > contents in the CALayer, on what object shall I draw? A CGLayer? Something > else? There are only 2 types of context you can create (bitmap & pdf) and only one that can give you a CGImage as a result of the drawing (bitmap). >> If you mean to see the drawing as it progresses, you will need to manage >> that yourself. You would likely want to completely overhaul your rendering >> process to do it however, as using a small fixed number of tiles would make >> this very slow as you would end up needing to respecify content you've >> already specified (basically draw-upload-draw-upload). > > The trick would obviously be drawing offscreen and then fire a timer each > second or so to upload content until the full drawing is done. Why not? The problem isn't so much in implementing that as the performance implications of doing that. You may very well get it working quickly, but at the same time you may not like the results or the performance. Or you may find it is fine for what you are doing. It will depend a lot on how much content you have and the specifications of the system you are running on. -- 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: Forcing menu update in 10.4?
Thanks for the advice, you are absolutely correct, now the menu update behaves as expected. On 1/28/10 1:33 PM, "Kyle Sluder" wrote: > On Jan 28, 2010, at 9:50 AM, Michael Domino > wrote: > >> Is that clearer? > > Yes. It's even clearer now that you should be implementing the UI > validation protocol. ;-) > > --Kyle Sluder >> -- Michael Domino michael.dom...@identityfinder.com Phone: 617-816-5851 Identity Finder, LLC 250 West 57th St; Suite 1400 New York, NY 10107 http://www.identityfinder.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
Apparent NSTableView Bug
I have run up against an apparent 10.6.2 bug in the NSTableView object. Specifically, if NSTableViewSelectionHighlightStyleNone is set, the tableView causes Assertion failures and other problems. Below is some code demonstrating the problem. In any event, I need to emulate the None style for highlight in my TableView. Does anyone know how to set the highlight color, perhaps, to clearColor or something with a tiny alpha value so it approximates the None appearance? I can live with undocumented changes, as the program will run on a system with a fixed OS, and I can un-hack the NSTableView when the problem is repaired. (Radar ID# 7588256). If I've done something wrong and this code is the problem, please tell me, as I'm sort of stuck for now. Thanks! -Dan Sample code: create a new Cocoa project, drag a tableView into IB, wire it to your controller. When you add a row, click on the header, then on the tableView cell. If you comment out the highlightStyle line, this aberrant behavior disappears. @implementation MArrayCont - (void)awakeFromNib { mColTitles = [[NSArray arrayWithObjects:@"One", @"Two", nil] retain]; NSArray *mCols = [myTableView tableColumns]; int i=0; for (NSTableColumn *aCol in mCols) { [aCol bind:@"value" toObject:self withKeyPath:[NSString stringWithFormat:@"arrangedObjects.%@", [mColTitles objectAtIndex:i]] options:nil]; i++; } [myTableView setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleNone]; } - (IBAction)add:(id)sender { NSMutableDictionary *mNewRow = [[[NSMutableDictionary alloc] init] autorelease]; int i=[[self content] count]; // Just provides some uniqueness to each entry. for (NSString *aColTitle in mColTitles) { [mNewRow setObject:[NSString stringWithFormat:@"%i: %@",i, aColTitle] forKey:aColTitle]; } [self addObject:mNewRow]; } - (void)dealloc { [mColTitles release]; [super dealloc]; } @end___ 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: Apparent NSTableView Bug
It's definitely a bug in AppKit; thank you for logging it, and including a test case. Try setting -setAllowsColumnSelection:NO. That work? corbin On Jan 28, 2010, at 2:00 PM, Daniel Wambold wrote: > I have run up against an apparent 10.6.2 bug in the NSTableView object. > Specifically, if NSTableViewSelectionHighlightStyleNone is set, the tableView > causes Assertion failures and other problems. Below is some code > demonstrating the problem. In any event, I need to emulate the None style for > highlight in my TableView. Does anyone know how to set the highlight color, > perhaps, to clearColor or something with a tiny alpha value so it > approximates the None appearance? I can live with undocumented changes, as > the program will run on a system with a fixed OS, and I can un-hack the > NSTableView when the problem is repaired. (Radar ID# 7588256). If I've done > something wrong and this code is the problem, please tell me, as I'm sort of > stuck for now. > Thanks! > -Dan > > Sample code: create a new Cocoa project, drag a tableView into IB, wire it to > your controller. When you add a row, click on the header, then on the > tableView cell. If you comment out the highlightStyle line, this aberrant > behavior disappears. > > @implementation MArrayCont > > - (void)awakeFromNib > { > mColTitles = [[NSArray arrayWithObjects:@"One", @"Two", nil] retain]; > NSArray *mCols = [myTableView tableColumns]; > int i=0; > for (NSTableColumn *aCol in mCols) > { > [aCol bind:@"value" toObject:self > withKeyPath:[NSString stringWithFormat:@"arrangedObjects.%@", > [mColTitles objectAtIndex:i]] > options:nil]; > i++; > } > [myTableView > setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleNone]; > > } > > - (IBAction)add:(id)sender > { > NSMutableDictionary *mNewRow = [[[NSMutableDictionary alloc] init] > autorelease]; > int i=[[self content] count]; // Just provides some > uniqueness to each entry. > for (NSString *aColTitle in mColTitles) > { > [mNewRow setObject:[NSString stringWithFormat:@"%i: %@",i, > aColTitle] forKey:aColTitle]; > } > [self addObject:mNewRow]; > } > > - (void)dealloc > { > [mColTitles release]; > [super dealloc]; > } ___ 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: Apparent NSTableView Bug
Corbin- Looks like [myTableView setAllowsColumnSelection:NO]; stopped the crashing for now (I'm sure I've made plenty of other mistakes that are lurking in the dark) Thanks for the tip! -dan___ 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
Simulating drag and drop to another application - possible?
Hello. I want to build a graphical application (App A) that would simulate a file drop onto certain areas of another running application (App B) at the touch of a button. The particular file that would be dropped, and the particular area of App B that it would be dropped onto, would depend on the state of the App A and which button was pressed. Would this be possible? Thank you, Van Mardian ___ 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
I get a "Pending Breakpoint" while running a Unit Test
I am using this document as my guide: http://developer.apple.com/mac/articles/tools/unittestingwithxcode3.html OS: Snow Leopard, XCode 3.2.1 iMac - Quad CPU. I am able to run the sample as outlined, see the test failures, correct the bug and watch the test pass. When I try to set a break point on one of the test cases and run the application according to the document, I get a message that the break point was 'resolved'. (Note: I reintroduced the error in the sample code). Actual Message in the Debugger Console - Pending breakpoint 2 - ""RightTriangleTestCase.m":17" resolved The debugger never breaks at the break point and it's waiting(I assume it's waiting for the process or code to load). Any ideas getting around this problem? Thanks in Advanced, Tony -tony ___ 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: NSKeyValueBindingCreation Leak
On Jan 28, 2010, at 11:12, Richard Somers wrote: > Actually that is about all there is (and it works except for the leak). I > started with Malcolm Crawford's "Graphics Bindings" example. It is the most > complex programmatic example he has but just so happened to be the one that > fit my need. I got hopelessly lost trying to understand the code and just > started tossing things until I got down to a level that I could start to > comprehend what was going on. > > http://homepage.mac.com/mmalc/CocoaExamples/controllers.html But you did nothing like what's in that example. It defines (and exposes) 2 named bindings of the custom view object, and implements all of the behavior associated with each binding. The [bind:...] implementation is just one piece of the whole. As it happens (whether by accident or design isn't clear), you can pass a property name as the first parameter instead of a true binding name, and you'll end up with a uni-directional "binding" (as if you observed the bound-to property and updated the bound-from property whenever it changes). This may be sufficiently functional for your current project, but it's not really a binding, and it's not at all obvious that this behavior will continue to exist. > Programmatic bindings can be simplified. For example refer to "Implementing > Your Own Cocoa Bindings" by Tom Dalling. > > www.tomdalling.com/cocoa/implementing-your-own-cocoa-bindings That blog clearly states that [bind:...] is only half of the behavior of a binding. > Any way it is true that "array" is an instance variable of the CustomObject > which is bound to a NSArrayController. > > The purpose of the binding is to iterate over arrangedObjects like this. > >for (id foo in array) { >// each foo do your thing >} What's wrong with: for (id foo in arrayController.arrangedObjects) ... ? After all, "arrangedObjects" is documented to be an array. (It's actually a kind of proxy, but it has the behavior of an array.) > Also the "arrangedObjects.changed" observation of each foo does work. In general, you can't observe an array (though you can observe an array property of an arbitrary object), and KVC conventions make "arrangedObjects.changed" be a reference to an array. Presumably it works because there is something special about the "arrangedObjects" proxy, but there's not guarantee of this behavior AFAIK. ___ 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
NSXML and invalid UTF8 characters
Hello, I am using the NSXML classes to generate and parse my own XML files. Sometimes these files store strings of text that has been brought in from other applications (for instance, there might be a plain text representation of some text the user has pasted in from Word). In some instances I am receiving errors in NSXMLDocument's -initWithContentsOfURLPreservingWhitespace:error:, causing it to return nil with errors such as "Char 0x0 out of allowed range" or "PCDATA invalid char value 12". As I understand it, this is because XML doesn't allow certain ranges of UTF8 characters: http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char Especially: Character Range [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x1-#x10] /* any Unicode character, excluding the surrogate blocks, FFFE, and . */ Certainly, the "PCData invalid char" error was caused by an NSFormFeedCharacter - I don't know what the "Char 0x0" character is, but it's bound to be one from a Word document that isn't allowed. So, my question is, what is the best way for me to filter out these invalid characters from my NSString before I pass it into NSXMLElement's -initWithName:stringValue: or similar methods, to avoid creating XML documents that won't open? This page seems useful: http://cse-mjmcl.cse.bris.ac.uk/blog/2007/02/14/1171465494443.html It would seem to indicate that I would need to write some code in C to compile a string without the invalid characters, and build it into an NSString, but I was wondering if there were any methods built into the AppKit that already strip these invalid XML characters? I have looked but couldn't see any. If not, if anyone could give me any pointers on using the above info to create a method that would do this, I would be very grateful. I'm self-taught so all my knowledge is high-level Cocoa and Objective-C, so I'd end up doing it all using NSString -appendString, -stringWithFormat: methods, which I know would be wrong for this as it would be too slow and requires C. Many thanks in advance for any help anyone can give. All the best, Keith ___ 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: NSXML and invalid UTF8 characters
On Thu, Jan 28, 2010 at 6:16 PM, Keith Blount wrote: > I am using the NSXML classes to generate and parse my own XML files. > Sometimes these files store strings of text that has been brought in from > other applications (for instance, there might be a plain text representation > of some text the user has pasted in from Word). For what it's worth, another common cause of problems with stuff pasted from Word (at least on the web), is Word docs that contain characters from the Windows-1252 character set that are invalid UTF-8 byte sequences. Most commonly, 0x80-0x9F, which is the range where Windows-1252 differs from ISO-Latin-1. So whatever solution you come up with to deal with the characters 0x00-0x1F that XML specifically doesn't allow, you probably want to also account for ranges like 0x80-0xFF that aren't valid UTF-8 at all. http://en.wikipedia.org/wiki/UTF-8#Invalid_byte_sequences http://en.wikipedia.org/wiki/Windows-1252 Sixten ___ 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: Simulating drag and drop to another application - possible?
On Jan 27, 2010, at 10:51 PM, Van Mardian wrote: I want to build a graphical application (App A) that would simulate a file drop onto certain areas of another running application (App B) at the touch of a button. I don't believe there have ever been public APIs for simulating drag- and-drop at that level. It only runs under the control of the actual mouse. (Unless there's something in the accessibility APIs that allows this?) What exactly are you trying to do? Are you sure there isn't a way to use AppleScript or something similar to tell app B to accept a new piece of data? —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: NSXML and invalid UTF8 characters
On Jan 28, 2010, at 3:16 PM, Keith Blount wrote: So, my question is, what is the best way for me to filter out these invalid characters from my NSString before I pass it into NSXMLElement's -initWithName:stringValue: or similar methods, to avoid creating XML documents that won't open? Make an NSCharacterSet containing the 'bad' characters. Make a mutable copy of the string. Use -[NSString rangeOfCharactersFromSet:options:range:] to iterate through the string finding the 'bad' characters. Delete each bad character from the mutable string as you find it. If there are only a handful of bad characters, it might be more straightforward to use NSMutableString's replaceOccurrencesOfString:withString:options:] method instead to delete them one at a time. —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: NSXML and invalid UTF8 characters
Thanks for the heads up. Actually this came up recently - a character had pasted some Word characters into my app, including a non-valid UTF8 one, and it was throwing exceptions on loading the text storage (it turned out that using -replaceCharactersInRange:withAttributedString after init'ing the NSTextStorage rather than using -initWithAttributedString: fixed the exceptions, but I reported it to Apple as obviously it can cause problems with the text system. I think the XML specs page I cited lists the actual valid UTF8 ranges, though, so as long as I can find a way just to include characters from within them I should be good, I think. I'm assuming the solution will be to cycle through all characters in the string using -characterAtIndex:, checking the character is within the valid ranges, but I'm not entirely sure of the best way of doing this, even though I'm sure it seems simple to those more grounded in C. Thanks again. All the best, Keith --- On Thu, 1/28/10, Sixten Otto wrote: > From: Sixten Otto > Subject: Re: NSXML and invalid UTF8 characters > To: "Keith Blount" > Cc: cocoa-dev@lists.apple.com > Date: Thursday, January 28, 2010, 11:30 PM > On Thu, Jan 28, 2010 at 6:16 PM, > Keith Blount > wrote: > > I am using the NSXML classes to generate and parse my > own XML files. Sometimes these files store strings of text > that has been brought in from other applications (for > instance, there might be a plain text representation of some > text the user has pasted in from Word). > > For what it's worth, another common cause of problems with > stuff > pasted from Word (at least on the web), is Word docs that > contain > characters from the Windows-1252 character set that are > invalid UTF-8 > byte sequences. Most commonly, 0x80-0x9F, which is the > range where > Windows-1252 differs from ISO-Latin-1. > > So whatever solution you come up with to deal with the > characters > 0x00-0x1F that XML specifically doesn't allow, you probably > want to > also account for ranges like 0x80-0xFF that aren't valid > UTF-8 at all. > > http://en.wikipedia.org/wiki/UTF-8#Invalid_byte_sequences > http://en.wikipedia.org/wiki/Windows-1252 > > Sixten > ___ 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: NSXML and invalid UTF8 characters
Many thanks for your reply. Wouldn't using these methods be a lot more expensive (and slower) than going through using -characterAtIndex: or something similar, accessing the characters directly, though? I'm thinking that I would have to add every character to the character set and then let NSString deal with all the underlying character stuff this way, whereas if I could check the unicode char is within a range then it would be faster. I could be entirely wrong though, which is why I'm asking. :) Thanks again and all the best, Keith --- On Thu, 1/28/10, Jens Alfke wrote: > From: Jens Alfke > Subject: Re: NSXML and invalid UTF8 characters > To: "Keith Blount" > Cc: cocoa-dev@lists.apple.com > Date: Thursday, January 28, 2010, 11:40 PM > > On Jan 28, 2010, at 3:16 PM, Keith Blount wrote: > > > So, my question is, what is the best way for me to > filter out these invalid characters from my NSString before > I pass it into NSXMLElement's -initWithName:stringValue: or > similar methods, to avoid creating XML documents that won't > open? > > > Make an NSCharacterSet containing the 'bad' characters. > Make a mutable copy of the string. > Use -[NSString rangeOfCharactersFromSet:options:range:] to > iterate through the string finding the 'bad' characters. > Delete each bad character from the mutable string as you > find it. > > If there are only a handful of bad characters, it might be > more straightforward to use NSMutableString's > replaceOccurrencesOfString:withString:options:] method > instead to delete them one at a time. > > —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
mouseEntered/-mouseExited not firing on drag (NSTrackingEnabledDuringMouseDrag on)
I've managed to set up a series of NSTrackingAreas. These tracking areas work beautifully, highlighting and de-highlighting in turn by means of -mouseEntered and -mouseExited. The problem I've run into is that -mouseEntered and -mouseExited do not fire on a drag. Here is the code I've used to set up the tracking: NSTrackingArea *trackArea = [[NSTrackingArea alloc] initWithRect:rect options:(NSTrackingMouseEnteredAndExited | NSTrackingEnabledDuringMouseDrag | NSTrackingActiveAlways) owner:self userInfo:userInfo]; I then add the trackArea to the view. Once set up, -mouseEntered/- mouseExited fire as expected when the mouse hovers over the tracking areas. But not during a drag. It is my understanding that the "NSTrackingEnabledDuringMouseDrag" is supposed to allow -mouseEntered/-mouseExited to fire during a drag. Is this not correct? I've also tried adding the NSTrackingMouseMoved option, and found that -mouseMoved fires, but again not with a drag. Any ideas? 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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSXML and invalid UTF8 characters
As an update, I tried this, which seems to partially work: - (NSString *)stringCleanedForXML // in an NSString category { unichar character; NSInteger index, len = [self length]; NSMutableString *cleanedString = [[NSMutableString alloc] init]; for (index = 0; index < len; index++) { character = [self characterAtIndex:index]; if (character == 0x9 || character == 0xA || character == 0xD || (character >= 0x20 && character <= 0xD7FF) || (character >= 0xE000 && character <= 0xFFFD) || (character >= 0x1 && character <= 0x10)) [cleanedString appendFormat:@"%C", character]; } return [cleanedString autorelease]; } Using this saved my XML strings in such a way as they didn't produce errors on loading, but this line: (character >= 0x1 && character <= 0x10) Throws up this compiler warning: "Comparison is always false due (they mean "owing"... :) ) to limited range of data type." But I got these ranges from the XML site: http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char and based the above method on non-Cocoa code here: http://cse-mjmcl.cse.bris.ac.uk/blog/2007/02/14/1171465494443.html Obviously it's down to my misunderstanding though. So my questions are now: a) Why am I getting this error (i.e. what dunderheaded thing am I doing wrong)? b) Does the above achieve what I wanted and create a string containing only the UTF8 characters specified in the XML docs cited above? c) Is this the fastest way of doing it or is there a faster way? Thanks again! All the best, Keith --- Original e-mail --- Hello, I am using the NSXML classes to generate and parse my own XML files. Sometimes these files store strings of text that has been brought in from other applications (for instance, there might be a plain text representation of some text the user has pasted in from Word). In some instances I am receiving errors in NSXMLDocument's -initWithContentsOfURLPreservingWhitespace:error:, causing it to return nil with errors such as "Char 0x0 out of allowed range" or "PCDATA invalid char value 12". As I understand it, this is because XML doesn't allow certain ranges of UTF8 characters: http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char Especially: Character Range [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x1-#x10] /* any Unicode character, excluding the surrogate blocks, FFFE, and . */ Certainly, the "PCData invalid char" error was caused by an NSFormFeedCharacter - I don't know what the "Char 0x0" character is, but it's bound to be one from a Word document that isn't allowed. So, my question is, what is the best way for me to filter out these invalid characters from my NSString before I pass it into NSXMLElement's -initWithName:stringValue: or similar methods, to avoid creating XML documents that won't open? This page seems useful: http://cse-mjmcl.cse.bris.ac.uk/blog/2007/02/14/1171465494443.html It would seem to indicate that I would need to write some code in C to compile a string without the invalid characters, and build it into an NSString, but I was wondering if there were any methods built into the AppKit that already strip these invalid XML characters? I have looked but couldn't see any. If not, if anyone could give me any pointers on using the above info to create a method that would do this, I would be very grateful. I'm self-taught so all my knowledge is high-level Cocoa and Objective-C, so I'd end up doing it all using NSString -appendString, -stringWithFormat: methods, which I know would be wrong for this as it would be too slow and requires C. Many thanks in advance for any help anyone can give. All the best, Keith ___ 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: NSXML and invalid UTF8 characters
On 29/01/2010, at 11:29 AM, Keith Blount wrote: > As an update, I tried this, which seems to partially work: > - (NSString *)stringCleanedForXML // in an NSString category { unichar character; > [] > Using this saved my XML strings in such a way as they didn't produce errors > on loading, but this line: > > (character >= 0x1 && character <= 0x10) > > Throws up this compiler warning: > > "Comparison is always false due (they mean "owing"... :) ) to limited range > of data type." > > But I got these ranges from the XML site: > > http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char > > and based the above method on non-Cocoa code here: > > http://cse-mjmcl.cse.bris.ac.uk/blog/2007/02/14/1171465494443.html > > Obviously it's down to my misunderstanding though. So my questions are now: > a) Why am I getting this error (i.e. what dunderheaded thing am I doing > wrong)? Because unichar is defined thus (NSString.h): typedef unsigned short unichar; Which only holds 16 bits. 0x1 and 0x10 are (at least) 20 bit constants. --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: NSXML and invalid UTF8 characters
On 29/01/2010, at 11:34 AM, Graham Cox wrote: > 0x10 are (at least) 20 bit constants 24-bits in this case (misread 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: Simulating drag and drop to another application - possible?
App A is basically a custom file browser that I'm designing for a touchscreen display. App B is some music production software that accepts file drops into various "tracks". App A would be running on the touchscreen and App B would be running on the main display. On Thu, Jan 28, 2010 at 6:36 PM, Jens Alfke wrote: > > On Jan 27, 2010, at 10:51 PM, Van Mardian wrote: > >> I want to build a graphical application (App A) that would simulate a >> file drop onto certain areas of another running application (App B) at >> the touch of a button. > > I don't believe there have ever been public APIs for simulating > drag-and-drop at that level. It only runs under the control of the actual > mouse. (Unless there's something in the accessibility APIs that allows > this?) > > What exactly are you trying to do? Are you sure there isn't a way to use > AppleScript or something similar to tell app B to accept a new piece of > data? > > —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: Fuzzy Focus Ring
> Oh, it looks like you can eliminated most of the code below if you're > targetting Mac OS 10.5+. > > #import > > @interface NSView (FocusRing) Ah -- a quick side note on this code sample. Adding a category to NSView with generic names (like drawFocusRing) is quite dangerous. The issue is that we (AppKit/Apple) could introduce the same name and conflict with your category. Instead, I recommend using your own unique prefix to the category, ie: -cdDrawFocusRing, etc. corbin > > - (void)patchPreLeopardFocusRingDrawingForScrolling ; > > - (void)drawFocusRing ; > // Although the above method invokes -lockFocus, and thus will work if > // invoked while not within -drawRect, it is recommended to invoke this > // method from within -drawRect, to avoid the possibility of a > // later invocation of -drawRect by Cocoa for some other purpose, which it > // does frequently, will wipe out the focus ring that has just been drawn. > // This can happen even before the focus ring has a chance to show! > > @end > > @implementation NSView (FocusRing) > > // Invoke the following metod during -awakeFromNib > - (void)patchPreLeopardFocusRingDrawingForScrolling { >if (NSAppKitVersionNumber < 900) { >// In Tiger and Panther, the remnants of the focus ring will stay >// on screen as the view is scrolled. The following patch fixes that: >NSView* clipView = self; >while((clipView = [clipView superview]) != nil) { >if([clipView isKindOfClass:[NSClipView class]]) >break ; >} > >[(NSClipView*)clipView setCopiesOnScroll:NO] ; >} > } > > - (void)drawFocusRing { >[self lockFocus] ; // Needed in case we were not invoked from within > drawRect: >[[NSColor keyboardFocusIndicatorColor] set]; >NSRect rect = [self visibleRect] ; >[NSGraphicsContext saveGraphicsState]; >NSSetFocusRingStyle(NSFocusRingOnly); >NSFrameRect(rect); >[NSGraphicsContext restoreGraphicsState]; >// The above code is from: >// http://www.cocoabuilder.com/archive/message/cocoa/2003/4/7/88648 >// The remainder of that message applies to pre-Leopard only >// and is implemented in this class' > -patchPreLeopardFocusRingDrawingForScrolling. >[self unlockFocus] ; // Balance lockFocus > } > > @end > > ___ > > 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/corbind%40apple.com > > This email sent to corb...@apple.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: IKImageBrowserView drop operation always highlighting a specific row
Hi Tobias, The equivalent of setDropRow:dropOperation for the IKimageBrowserView is - (void) setDropIndex:(NSInteger)index dropOperation:(IKImageBrowserDropOperation)operation; available on 10.6 -- Thomas On Jan 28, 2010, at 10:01 PM, Tobias Jordan wrote: > Hey guys, > > first off thank you for your time, I really appreciate it! So I am having > problems with the drag'n'drop of the IKImageBrowserView. In my case I am > dragging a file to the view which is automatically sorted case insensitive > which means the user isn't able to re-arrange objects in it which is fine. > It's more like a graphical confusion since the view always highlights an > index to be dropped on but this isn't the case since it's automatically > rearranging itself so what's required is a highlight of the entire view, not > an index. > I'd say I am looking for this NSTableView method for the IKImageBrowserView: > setDropRow:dropOperation:… the docs say 'Passing a value of -1 for a row and > NSTableViewDropOn as the operation causes the entire table view to > hightlighted rather than a specific row'. That's exactly what I am looking > for. If there's a way to disable the entire blue selection rectangle, I'd be > fine with it too, it's just that I didn't find any way yet and all demos on > the net are letting the user sort the view. > > I hope you understand what I am having problems with. > > Thanks and best regards, > Tobias___ > > 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/tgoossens%40mac.com > > This email sent to tgooss...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hiding tab view items
Hi all, I am just following up on my previous queries about how to show a hierarchy of Nodes in the left pane (like iTunes or Disk Utility) and have the available tab view items on the right change according to the type of node that the user selects. Thanks to Volker, Kyle, Nathan and "Idiot Savant" for earlier replies. I think I understand now how to retain tab view items so they can be removed and reinserted. I managed to set up my tab view to remove and reinsert particular tab views according to what Node is selected, by using the NSOutlineView delegate method. I first retain all the tab view items in the awakeFromNib handler. The example below checks whether the selected nodeType is "table". It then removes or inserts the tab view item with the identifier "Table" in the tab view. This seems to work OK so far. If I've goofed anywhere, please let me know, via the mail list. @interface MyController : NSObject { IBOutlet NSTabView* tabView; IBOutlet NSTreeController* nodeTreeController; NSArray* retainedTabViewItems; } @end @implementation MyController - (void) awakeFromNib { retainedTabViewItems = [tabView tabViewItems]; [retainedTabViewItems retain]; } - (void) dealloc { [retainedTabViewItems release]; [super dealloc]; } - (void) outlineViewSelectionDidChange:(NSNotification*)notification { NSString* nodeType = [nodeTreeController valueForKeyPath:@"selection.type"]; NSInteger visibleTabViewItemIndex = [tabView indexOfTabViewItemWithIdentifier:@"Table"]; NSTabViewItem* retainedTabViewItem = nil; for (int tabViewItemIndex = 0; tabViewItemIndex < [retainedTabViewItems count]; tabViewItemIndex++) { retainedTabViewItem = [retainedTabViewItems objectAtIndex:tabViewItemIndex]; NSString* retainedTabViewItemIdentifier = [retainedTabViewItem identifier]; if ([retainedTabViewItemIdentifier isEqualToString:@"Table"]) break; } BOOL tabViewItemShouldShow = [nodeType isEqualToString:@"table"]; BOOL tabViewItemDoesShow = visibleTabViewItemIndex != NSNotFound; if (tabViewItemShouldShow && !tabViewItemDoesShow) { [tabView insertTabViewItem:retainedTabViewItem atIndex:3]; } else if (!tabViewItemShouldShow && tabViewItemDoesShow) { [tabView removeTabViewItem:retainedTabViewItem]; } } // other code omitted @end From: BareFeet Date: 21 October 2009 6:02:21 PM AEDT To: Cocoa Dev Subject: Re: Hiding tab view items This seems like a common requirement, so I keep thinking I must be missing something simple. For an example of similar functionality, look at Disk Utility. The user can navigate through a tree of nested disks and partition nodes in the left view. The right view shows a tab view that changes its tab items depending on what tree node is selected on the left. For instance, if you select a disk, you see the tab view items: First Aid, Erase, Partition, RAID and Restore. But if you select a partition, the "Partition" tab view item disappears. Since there is no hidden/visible property for tab view items, it seems that I have to dynamically delete and create tab view items From: BareFeet Date: 13 October 2009 1:53:03 AM AEDT To: Cocoa Dev Subject: Hiding tab view items Hi all, I have a hierarchical list of objects, like the typical iTunes or XCode left pane. When the user selects a node in this hierarchy, I display detail of that node in the pane on the right. This right pane is divided into tab view items. Only some of the tab view items are relevant to each type of node, so I'd like to hide the tab view items that are not relevant. How can I do this? In Interface Builder, I can't see any "hidden" property of tab view item. There is a "hidden" property for the sub-view of a tab view item, but this doesn't hide the tab view item itself, so is misleading to the user (ie they can click on it, only to see a blank view). ___ 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
can NSCollectionView be made to ask for properties in a lazy manner
I have an array within a model object that is hooked up to a NSCollectionView via an NSArrayController and NSCollectionViewItem (i.e. standard). The array elements are custom objects with a title and image property. These are bound to an NSTextField and NSImageView within the view managed by the collection-view-item. Hook all the bindings up and go. It works... basically. Problem: the properties for EVERY element within the array are requested when the collection view appears on screen. Well, really, I am binding the collection view to the array controller in code within awakeFromNib and the trouble happens at the point of binding (thus, I think the ask-for-everything really happens independent of the appear-on-screen issue). Partial/edited backtrace: my call to [collectionview bind:toObject:withKeyPath:options:] triggers [collectionview setContent:] [collectionview _getItemsToDisplay] [array-element image] I guess "_getItemsToDisplay" does not care about what is actually being displayed NOW vs. the entirety of what can be displayed. This was not what I was expecting nor wanting. My experience in the datasource flavor of NSTableView led me to believe (and be happy about) UI elements not asking for display data until view/cell associated with said data was truly on-screen. Perhaps NSTableView is just as greedy about touching every element once you depend on bindings (but I'm guessing not). Question: can this behavior be avoided through simple means? I have seen some related discussions ( http://lists.apple.com/archives/Cocoa-dev/2009/Jan/msg01536.html ) but I believe the discussed situations (and potential solutions to them) do not cover my setup (which I think would be a common one). I don't need to build the array-like structure as I go and, thus, I don't care if some part of bindings asks for the entire array of content. What I care about is the properties of the elements in this array being accessed before the associated row appears on-screen. The image property is calculated on-demand and it is better performance and memory usage to NOT pre-calculate every image. Do I have to hack away or can the collection be convinced to operate in this (I think, obvious/superior) "lazy loading" style? Thanks in advance. Mark Sanvitale Real Networks ___ 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
[MEET] February CocoaHeads Developer Meetings
Greetings, CocoaHeads is an international Cocoa programmer's group. Meetings are free and open to the public. We specialize in Cocoa, but everything Mac/iPhone programming related is welcome. Upcoming meetings: Australia Sydney- Thursday, February 4, 2010 18:30. Austria Wien- Thursday, February 11, 2010 19:00. Germany Frankfurt- Monday, February 1, 2010 19:30. Munich- Wednesday, February 10, 2010 19:00. Sweden Stockholm- Monday, February 1, 2010 19:00. Switzerland Zürich- Wednesday, February 10, 2010 19:00. United States Ann Arbor- Thursday, February 11, 2010 19:00. Birmingham- Thursday, February 11, 2010 19:00. Boulder- Tuesday, February 9, 2010 19:00. Colorado Springs- Thursday, February 11, 2010 19:00. Columbus- Tuesday, February 9, 2010 19:00. Denver- Tuesday, February 9, 2010 19:00. Des Moines- Thursday, February 11, 2010 19:00. Philadelphia- Thursday, February 11, 2010 19:00. Sacramento- Tuesday, February 2, 2010 17:00. Some chapters may have yet to post their meeting for next month. Meeting times may change. Locations and more information here: http://cocoaheads.org Also be sure to check for an NSCoder Night in your area: http://nscodernight.com/ Steve Silicon Valley CocoaHeads___ 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: NSXML and invalid UTF8 characters
On Jan 28, 2010, at 3:47 PM, Keith Blount wrote: > Many thanks for your reply. Wouldn't using these methods be a lot more > expensive (and slower) than going through using -characterAtIndex: or > something similar, accessing the characters directly, though? No, because it's more efficient to let NSString itself do the searching, avoiding the overhead of a message-send per character. > I'm thinking that I would have to add every character to the character set > and then let NSString deal with all the underlying character stuff this way, > whereas if I could check the unicode char is within a range then it would be > faster. You can easily create an NSCharacterSet on any range of Unicode values. BTW, it's inaccurate to say "invalid UTF-8". UTF-8 is just an encoding of Unicode. You're talking about Unicode characters that are illegal in XML. (I bring this up because there is such a thing as invalid UTF-8, i.e. byte sequences that are invalid in UTF-8 encoding, but it's an entirely different issue; this confused me when I first read your message.) —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: NSXML and invalid UTF8 characters
On Jan 28, 2010, at 4:29 PM, Keith Blount wrote: > [cleanedString appendFormat:@"%C", character]; If you're worried about efficiency, format conversions like this are particularly slow; so is building up an NSString a character at a time. It's more efficient to allocate a unichar[] buffer with sufficient capacity, put characters in it, and then create an NSString in one operation. It's probably not a big deal, though, unless you're running this on extremely long strings or on huge numbers of them. —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: Hot to define a connection from source code?
Hello everybody, OK, thanks for the information... I'll find info about @selector, setActions in Objetive-C and I'll post this question in xCode list. I want to develop some games for blind users in iPhone thanks and regards Jonathan Chacón El 28/01/2010, a las 22:08, Jens Alfke escribió: > > On Jan 28, 2010, at 11:05 AM, Jean-Daniel Dupas wrote: > >> I don't know any way to do it but in Interface Builder and unfortunately I >> don't see how to bind the outlet without mouse (but maybe someone has an >> idea). > > Oh! Sorry, Jonathan, I overlooked the word "blind" in your original message. > I didn't realize this is an accessibility issue. > > I don't know how to set up outlets and actions in Interface Builder without > control-dragging, and I can see how that would be a problem. You should ask > on the xcode-users mailing list, which is really for all the GUI development > tools including IB. > > —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: Hot to define a connection from source code?
Jonathan Chacón wrote: Hello everybody, OK, thanks for the information... I'll find info about @selector, setActions in Objetive-C and I'll post this question in xCode list. I want to develop some games for blind users in iPhone thanks and regards Jonathan Chacón El 28/01/2010, a las 22:08, Jens Alfke escribió: Jonathan, you don't have to use Interface Builder to create the user interface piece at all if you don't want to. You can just create, position and link the objects up yourself in code. That's actually how the original iPhone development was done, before they had IB for iPhone. Outlets are very simple, all an outlet is is an instance variable which is set to another object, so if in interface builder you connect a button to an outlet in your controller, the code equivalent is just to make the button [ [ UIButton alloc ] init .. ] and then set the controller member variable to that button. Actions are a little more complicated but not very much more so, reading up on the event dispatch for iPhone you'll quickly see how to register a selector for the given action on a control. I've found recently, as I understand the whole view controller model that iPhone uses, my NIBs (built in interface builder) are little more than a controller object and perhaps one small piece of customization, it could be done in code very simply. IB really comes into its own when developing for OS X where your interfaces can be quite complex, but for iPhone with the limited number of components, mostly using full-screen mode, code can work quite well. ___ 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: mouseEntered/-mouseExited not firing on drag (NSTrackingEnabledDuringMouseDrag on)
On 2010 Jan 28, at 16:00, K. Darcy Otto wrote: > It is my understanding that the "NSTrackingEnabledDuringMouseDrag" is > supposed to allow -mouseEntered/-mouseExited to fire during a drag. Is this > not correct? I hope someone who knows the answer to that specific question will answer you. > Any ideas? When I had a similar problem I was advised that whatever responds to mouseDown: probably begins tracking the mouse, sucking up all the NSMouseMoved events, until mouseUp. Try overriding mouseDown: and don't invoke super. ___ 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: NSKeyValueBindingCreation Leak
On Jan 28, 2010, at 4:04 PM, Quincey Morris wrote: But you did nothing like what's in that example. It defines (and exposes) 2 named bindings of the custom view object, and implements all of the behavior associated with each binding. The [bind:...] implementation is just one piece of the whole. Thanks for the reply. As I understand it, exposing the binding relates to exposing the binding to Interface Builder. Since I am not using Interface Builder exposing the binding is a non-issue. As it happens (whether by accident or design isn't clear), you can pass a property name as the first parameter instead of a true binding name, and you'll end up with a uni-directional "binding" ... Using the default NSObject implementation of - bind:toObject:withKeyPath:options: is only one-way. This behavior is not dependent on some characteristic of the first parameter. The binding will push model changes back to the controller or view; but view and controller changes must be manually propagated to the model. Currently for this particular binding that is all I need is a one-way binding. Regarding the "true binding name" that is something that has been confusing. At first I thought there was something magic in the "binding name". The documentation states that the first parameter for - bind:toObject:withKeyPath:options: is "The key path for a property of the receiver previously exposed using the exposeBinding: method." If we are not using Interface Builder then it simply becomes "The key path for a property of the receiver". My instance variable "array" is a property of "CustomObject" and so I think this is why this works as advertised. This may be sufficiently functional for your current project, but it's not really a binding, ... True this is not a fully functional "binding" as found in Interface Builder but for this programmatic binding I do not need all the bells and whistles. ... and it's not at all obvious that this behavior will continue to exist. You do have a point here. Apples documentation is really geared towards a "binding" being what you see in Interface Builder which behind the scenes appears to be a multitude of moving pieces and parts. Programmatic bindings on the other hand are somewhat of a black art perhaps because of the lack of documentation or the complexity of a fully functional binding as implemented by Apple in Interface Builder. That blog clearly states that [bind:...] is only half of the behavior of a binding. That is true. I think the question might be does -unbind: only undo what was done by using -bind:toObject:withKeyPath:options: or does it do more than that? I understood that they were just complementary methods. Use one and then use the other to nullify the effect of the first. The documentation seems to indicate that this is the case. Indeed for my other programatic bindings it appears to work like this except for this particular one which has a memory leak. What's wrong with: for (id foo in arrayController.arrangedObjects) ... ? After all, "arrangedObjects" is documented to be an array. (It's actually a kind of proxy, but it has the behavior of an array.) Interesting. I tried this as you suggested but it results in compiler errors. error: request for member 'arrangedObjects' in something not a structure or union error: expression does not have a valid object type In general, you can't observe an array (though you can observe an array property of an arbitrary object), and KVC conventions make "arrangedObjects.changed" be a reference to an array. Presumably it works because there is something special about the "arrangedObjects" proxy, but there's not guarantee of this behavior AFAIK. My NSArrayController is wired to a managed object context. I am observing the property of a managed object by passing the observation through the array. This part of my program has never not worked and I have never had any problems with it. Not that it means anything but here is an example of someone doing the same thing. http://stackoverflow.com/questions/973208/how-to-get-notified-of-changes-to-models-via-an-nsarraycontroller --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: Hot to define a connection from source code?
Hello Roland, Could you tell me any example project where I examine the source code? thanks and regards Jonathan Chacón El 29/01/2010, a las 06:04, Roland King escribió: > Jonathan Chacón wrote: >> Hello everybody, >> OK, thanks for the information... >> I'll find info about @selector, setActions in Objetive-C and I'll post this >> question in xCode list. >> I want to develop some games for blind users in iPhone >> thanks and regards >> Jonathan Chacón >> El 28/01/2010, a las 22:08, Jens Alfke escribió: > > Jonathan, you don't have to use Interface Builder to create the user > interface piece at all if you don't want to. You can just create, position > and link the objects up yourself in code. That's actually how the original > iPhone development was done, before they had IB for iPhone. > > Outlets are very simple, all an outlet is is an instance variable which is > set to another object, so if in interface builder you connect a button to an > outlet in your controller, the code equivalent is just to make the button [ [ > UIButton alloc ] init .. ] and then set the controller member variable to > that button. Actions are a little more complicated but not very much more so, > reading up on the event dispatch for iPhone you'll quickly see how to > register a selector for the given action on a control. > > I've found recently, as I understand the whole view controller model that > iPhone uses, my NIBs (built in interface builder) are little more than a > controller object and perhaps one small piece of customization, it could be > done in code very simply. IB really comes into its own when developing for OS > X where your interfaces can be quite complex, but for iPhone with the limited > number of components, mostly using full-screen mode, code can work quite well. > ___ 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
Network Reachability
Hello. Earlier this week, I asked how I could determine network reachability from my app. Someone replied to check the SystemConfiguration framework. I finally got around to have a look and wrote the following code: + (BOOL)hostIsReachable:(NSString *)hostName { CFHostRefhost; assert(hostName != NULL); /* Creates a new host object with the given name. */ host = CFHostCreateWithName(kCFAllocatorDefault, (CFStringRef)hostName); assert(host != NULL); SCNetworkReachabilityRef target = SCNetworkReachabilityCreateWithName(NULL, [hostName cStringUsingEncoding:NSUTF8StringEncoding]); assert( target != NULL); SCNetworkConnectionFlags flags; SCNetworkReachabilityGetFlags(target, &flags); BOOL result = (flags & kSCNetworkFlagsReachable); NSLog(@"PLHostReachability: host %@ is reachable: %@", hostName, result ? @"yes" : @"no"); CFRelease(target); return result; } However, no matter if I'm connected to the network or not, SCNetworkReachabilityGetFlags() always returns any host to be reachable. Am I missing something? Should I look for other flags? Any way to do this in Cocoa? Thanks in advance! -Laurent. -- Laurent Daudelin AIM/iChat/Skype:LaurentDaudelin http://nemesys.dyndns.org Logiciels Nemesys Software laurent.daude...@gmail.com Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries ___ 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: IKImageBrowserView drop operation always highlighting a specific row
Hi Thomas, thanks for the information, didn't know there exists such a method but is there a way to do it like this on Mac OS X 10.5 Leopard? - Tobias On Jan 29, 2010, at 2:24 AM, Thomas Goossens wrote: Hi Tobias, The equivalent of setDropRow:dropOperation for the IKimageBrowserView is - (void) setDropIndex:(NSInteger)index dropOperation: (IKImageBrowserDropOperation)operation; available on 10.6 -- Thomas On Jan 28, 2010, at 10:01 PM, Tobias Jordan wrote: Hey guys, first off thank you for your time, I really appreciate it! So I am having problems with the drag'n'drop of the IKImageBrowserView. In my case I am dragging a file to the view which is automatically sorted case insensitive which means the user isn't able to re- arrange objects in it which is fine. It's more like a graphical confusion since the view always highlights an index to be dropped on but this isn't the case since it's automatically rearranging itself so what's required is a highlight of the entire view, not an index. I'd say I am looking for this NSTableView method for the IKImageBrowserView: setDropRow:dropOperation:… the docs say 'Passing a value of -1 for a row and NSTableViewDropOn as the operation causes the entire table view to hightlighted rather than a specific row'. That's exactly what I am looking for. If there's a way to disable the entire blue selection rectangle, I'd be fine with it too, it's just that I didn't find any way yet and all demos on the net are letting the user sort the view. I hope you understand what I am having problems with. Thanks and best regards, Tobias___ 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/tgoossens%40mac.com This email sent to tgooss...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Network Reachability
On Jan 28, 2010, at 9:22 PM, Laurent Daudelin wrote: >host = CFHostCreateWithName(kCFAllocatorDefault, (CFStringRef)hostName); >assert(host != NULL); > > SCNetworkReachabilityRef target = > SCNetworkReachabilityCreateWithName(NULL, [hostName > cStringUsingEncoding:NSUTF8StringEncoding]); It seems redundant to convert the hostname string into a CFHost and then back into a string. Have you verified that you're getting a reasonable C string at the end? > SCNetworkReachabilityGetFlags(target, &flags); Try checking the error code this returns. All the examples I've seen do this asynchronously by setting up a runloop-based callback; I'm not certain that the flags are valid immediately after you create the ref. —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
Node hierarchy with subclasses
Hi All, Summary: I have an NSTreeController driven hierarchy of "Nodes" in my window's left pane. I'd like to subclass Node into a few subclasses. Each subclass in the model shows its own tab view item(s) in the view (right half of the document window). The tab view item contains UI elements (eg text fields), each of which is bound (via bindings) to a property of that subclass. The problem is that when a subclass A is selected, the UI elements bound to subclass B no longer have valid bindings so generate an error. How can I solve this? Example: As described before, I have my Node tree in the left pane and different tab view items showing on the right according to what Node is selected. I'd like to subclass Node according to type. If this was iTunes, for example, I might have subclasses like MoviesNode, PlayListNode etc as subclasses of the general Node class used in the tree. MoviesNode would have methods particular to showing the list of Movies which are not relevant for all Nodes, etc. For instance, I might have a "width" method that returns the width of a movie as an integer. I could display this value by creating a text field bound (ie via bindings) to the NSTreeController's selection.width model key path. If I show this text field in the Movies tab view item it works fine as long as I have selected a MoviesNode, but if I select a different subclass of Node (eg playlist) or no Node is selected (such as when the nib awakens), there is no width property, so it generates an error, similar to: HIToolbox: ignoring exception '[ addObserver: forKeyPath:@"width" options:0x100 context:0x0] was sent to an object that is not KVC-compliant for the "width" property.' that raised inside Carbon event dispatch I have tried to code the removal of the Movies tab containing the text field bound to the width property, but the error occurs before awakeFromNib is called and in the init method it's too early (since there's nothing yet loaded to remove). It seems to me to be a common UI layout to have a Node tree on the left and various UI elements on the right appearing according to what Node is selected. But how can I do this using bindings? Thanks, Tom BareFeet ___ 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