Re: Keeping NSView square
2009/11/18 Andrew Farmer andf...@gmail.com: Don't. Arbitrarily changing the size of your view in setFrame: makes AppKit lose track of what size your view was, making it impossible to restore the original size later. Cut the view down to square at draw time instead. This sounds like an even worse idea. If your concern is about autoresizing, override -resizeWithOldSuperviewSize:. Otherwise, never call -setFrame: with a non-square size. (Perhaps you can override -setFrame: to throw an exception if it's given a non-square frame.) --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: Keeping NSView square
On 19 Nov 2009, at 00:10, Kyle Sluder wrote: 2009/11/18 Andrew Farmer andf...@gmail.com: Don't. Arbitrarily changing the size of your view in setFrame: makes AppKit lose track of what size your view was, making it impossible to restore the original size later. Cut the view down to square at draw time instead. This sounds like an even worse idea. To be more specific - I wasn't suggesting adjusting the size of the view at draw time, or refusing to draw the entire dirty rect, but simply performing the min(frame width, frame height) calculation at draw time and drawing the view's content into the minimized rect. -resizeWithOldSuperviewSize: sounds like an excellent alternative, though, and probably more on-target.___ 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: Vector images on Cocoa
Try pdf files.:) Anderson www.anderson-oliveira.com On Nov 17, 2009, at 1:47 AM, Henri Häkkinen wrote: Hello. I would need some way of loading vectorized images from files and drawing them to my custom NSView derived class, scaled up or down according to the frame of the control. I was thinking of using SVG files but there seems not to be any easy way of handling them in Cocoa and I feel that implementing my own SVG parser would be of too much work. What would you recommend? EPS? Thank you. Regards, Henri Häkkinen ___ 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/andersonoliveirasf%40gmail.com This email sent to andersonoliveir...@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
IBOutlets or property + binding
Hi all, once again I got a rather general question: Say we got some view-elements which we don't wanna change in any way. We only need to read their value to compute something. Would you create IBOutlets or properties + binding in that case? Those values are not part of my model. They are not being persisted and I only need them temporarily to compute stuff. Thanks in advance, Chris ___ 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: setToolTip: not working
On Nov 18, 2009, at 8:30 PM, Gregory Weston wrote: Ben Haller wrote: [...] I get the impression that others are not seeing it because it's a problem that specially bites apps that build their UI in code, instead of in IB, and that's rare. I was trying to fish for someone who would say I build my UI in code, and I don't see this problem, but nobody spoke up. Are you such a person? I missed the beginning of this thread, but I am such a person and I don't experience the problem. Me too. Or rather, I just did a quick test with an NSButton and a trivial custom view, and it worked. It also worked when I replaced TestView below with NSView. - (void)awakeFromNib { NSWindow *testWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(100, 100, 500, 500) styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:NO]; [testWindow makeKeyAndOrderFront:self]; NSButton *testButton = [[NSButton alloc] initWithFrame:NSMakeRect(100, 50, 100, 20)]; [testButton setTitle:@Hover Over Me]; [testButton sizeToFit]; [testButton setToolTip:@This is an NSButton]; [[testWindow contentView] addSubview:testButton]; NSView *testView = [[TestView alloc] initWithFrame:NSMakeRect(100, 100, 100, 20)]; [testView setToolTip:@This is a test view]; [[testWindow contentView] addSubview:testView]; } Maybe you can temporarily add similar lines to your code and see if you see tooltips? I know you know better, but I'll ask some obvious questions. (Yes, your geneticBasisChanged code would seem to answer many of these questions, but maybe not your other code, and when confronted with code that can't be failing, I try to question obvious assumptions.) * Are you sure your calls to setToolTip: are being performed? * Are you sure the receiver is not nil at the time of the call? * Does [myView toolTip] return what you passed to setToolTip:? * Are you sure the receiver is the object you intended? For example, if you log a button's address when you setToolTip:, and log the sender's address in the button's action method, do you see the address you expect when you click the button? * Do you have any overlapping views that might be stealing the mouseEntered event? * I also wonder if there is some OS hack or defaults setting that is suppressing tooltips in general. Do you see tooltips in other apps? * How many views do you have that have tooltips? It *feels* like there is an extra long delay the first time I bring up a tooltip, and I wonder if there's some initial overhead that might increase with the number of tooltips. --Andy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Vector images on Cocoa
I would need some way of loading vectorized images from files and drawing them to my custom NSView derived class, scaled up or down according to the frame of the control. I was thinking of using SVG files but there seems not to be any easy way of handling them in Cocoa and I feel that implementing my own SVG parser would be of too much work. What would you recommend? EPS? Thank you. Regards, Henri Häkkinen PDF is a vector graphics image format (the evolution of EPS) and is also the default metafile format for Mac OS X. Scott ___ 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: SB won't create an element on 10.5
Fritz Anderson wrote: Otherwise, it looks like I'm caught in a crack between AppleScript, 10.5 Scripting Bridge, and Entourage. I may have to fall back to textual scripts (or, Lord help me, chains of AppleEvents and descriptors). It was nice while it lasted (and I should credit 10.6 for the improved handling). Try objc-appscript (http://appscript.sourceforge.net); works on 10.4 and later, and closely mimics the way that AppleScript builds Apple events so is far less prone to application compatibility problems than SB. Implementation is reasonably solid (I need to deal with various compiler warnings when building for 64-bit on 10.6, but 32-bit is fine), and it's based on a very mature, proven design. You also get better documentation and dev tools (ASDictionary and ASTranslate). If you already know how to write a working command in AppleScript, you will find ASTranslate especially helpful in converting it to its ObjC equivalent. HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Core Data: Simply set NSMigratePersistentStoresAutomaticallyOption in a Document?
Well, it's time to move my beta testers from 0.1.8 to 0.1.9 and this requires a Core Data database migration. Since the app requires 10.5, I can use Default Automatic Migration. Yippee. Up to this point, my NSPersistentDocument subclass had used the Persistence Stack which is built into NSPersistentDocument. However, this stack apparently does not create set NSMigratePersistentStoresAutomaticallyOption in its store. It looks to me like I need to override -managedObjectContext and implement that whole persistence stack enchilada just to set this one little, commonly-used option. Is there a shortcut? If indeed I need to implement the stack, where is the best place to splice in the pieces? I had been creating new documents from a wizard using -[NSDocumentController openUntitledDocumentAndDisplay:error:], and doing some configuration which required the moc at the end of -init. Now that doesn't work since I can't set a store in new documents before the fileURL has been set, which happens later. I'm imagining many ways to move things around, but I'd like to start out by doing it the *right* way. Sincerely, Jerry Krinock P.S. Sorry if this is in the list archives but since cocoabuilder.com is down I'm searching lists.apple.com. Searching with Search for: NSMigratePersistentStoresAutomaticallyOption Match: All Find: Substring Located In: Whole Document Listname Matches: cocoa-dev I get: Sorry, your search for NSMigratePersistentStoresAutomaticallyOption did not find any results. No documents were found containing NSMigratePersistentStoresAutomaticallyOption. Seems unbelievable.___ 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 Transitions
None of this makes any sense, other than the build-transitions being one level deeper in the hierarchy than the side transitions. You're right. As I read the documentation over and over again it didn't make any sense to me at all. First I thought it's the language, since my mother tongue is german. But that was not the case. After a long time of trial error I got it all working.. The different uses of the word key is horrible. Joachim Am 17.11.2009 um 18:05 schrieb Gordon Apple: Here's the current status. I seem to have everything working, partly due to you guys. Thanks. However, now having analyzed this thing to death, I'm filing a bug report. First a summary of the (extended) problem. The view is layer hosted. Its layer has a sublayer called content, which has sublayers, one of which is A, which is to be transitioned to B. This is akin to a PowerPoint/Keynote slide transition. Layers A and B also have sublayers, A1, A2, etc., which transition in al la build in PP. According to the docs, using [content addAnimation:trans forKey:kCATransition] should have worked for slide transitions. It didn't. However, using the delegate method, augmented by an ivar enable flag, did work. Next, tried the delegate method for builds. Didn't work. It transitioned in the entire layer stack (all sublayers of A or B) instead of the single inserted layer. So I went back to using [B addAnimation:trans forKey:kCAOnOrderIn] for builds. That worked properly. None of this makes any sense, other than the build-transitions being one level deeper in the hierarchy than the side transitions. Definition of software development: A series of experiments, hopefully culminating in the desired result. On 11/16/09 2:02 PM, cocoa-dev-requ...@lists.apple.com cocoa-dev-requ...@lists.apple.com wrote: On Mon, Nov 16, 2009 at 11:01 AM, Matt Neuburg m...@tidbits.com wrote: Nothing here runs contrary to the documentation. We're now talking apples and oranges. The key used in addAnimation:forKey: (such as kCATransition) has nothing whatever to do with the key that arrives in actionForLayer:forKey:. They both happen to be called key but that's all. The former, as I explained in my previous message, is just an arbitrary name, which is used just in case you need to call removeAnimationForKey: later, and for no other purpose. The latter is the name of a CALayer animatable property; that property is changing, and you are now being asked whether to animate that property. You have it backwards. kCATransition is documented to be sent as the action identifier to -actionForLayer:forKey: whenever the sublayer tree changes. Instead, CA is only sending @sublayers. This is incorrect. ___ 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/cocoa-dev%40deelen.de This email sent to cocoa-...@deelen.de ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: unable to select submenu item
On Nov 18, 2009, at 7:27 PM, SRD wrote: Here your code indicates that the Load menu item was selected, and according to everything you show, Load does *not* have a submenu, so everything is working as expected, unless you aren't selecting Load, in which case your problem isn't the same as you describe. Apologies, I grabbed the wrong output. Below is the output taken from selecting a submenu item ... 2009-11-18 20:24:40.341 test[6053:a0f] projectMenu = NSMenu: 0x10045c540 Title: ProjectMenu Supermenu: 0x0 (None), autoenable: NO Items: ( NSMenuItem: 0x10045c3e0 , NSMenuItem: 0x10045c650 Create, submenu: 0x10045c580 (Create), NSMenuItem: 0x10045d330 Load, NSMenuItem: 0x10045d730 , NSMenuItem: 0x10045d7b0 Save, NSMenuItem: 0x10045d860 Save As ... ) 2009-11-18 20:24:40.341 test[6053:a0f] menuItem NSMenuItem: 0x10045c3e0 2009-11-18 20:24:40.342 test[6053:a0f] hasSubMenu 0 2009-11-18 20:24:40.342 test[6053:a0f] submenu (null) 2009-11-18 20:24:40.343 test[6053:a0f] end IIRC, you are using a pulldown, so you want (or at least are asking for) menu-like behavior, so don't set the action on the NSPopupButton--set each action on the individual menu items. They can call the same action. The behavior you are seeing above is expected, AFAIK, when using pulldowns. Pulldowns don't maintain selection state as they are only for command execution. See the doc Application Menu and Pop-up List Programming Topics for Cocoa. HTH, Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: IBOutlets or property + binding
Would you create IBOutlets or properties + binding in that case? You will need to give an example of exactly what you want to accomplish. What values do you need?, etc. Then, perhaps it will be easier to answer. Peace - Hide quoted text - On Thu, Nov 19, 2009 at 5:48 AM, Christian Ziegler chris.zieg...@me.com wrote: Hi all, once again I got a rather general question: Say we got some view-elements which we don't wanna change in any way. We only need to read their value to compute something. Would you create IBOutlets or properties + binding in that case? Those values are not part of my model. They are not being persisted and I only need them temporarily to compute stuff. Thanks in advance, Chris ___ 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: IBOutlets or property + binding
On 19.11.2009, at 18:27, Karolis Ramanauskas wrote: Would you create IBOutlets or properties + binding in that case? You will need to give an example of exactly what you want to accomplish. What values do you need?, etc. Then, perhaps it will be easier to answer. Peace - Hide quoted text - For instance I got a NSStepper and I only need the integerValue of that stepper. I could either define an IBOutlet and access the integerValue with [stepper integerValue], or I could define a property and bind the steppers value to it. As I mentioned I don't have to manipulate that stepper in any way, I really only need the value. I just wanna know what's best practice. Cheers, Chris On Thu, Nov 19, 2009 at 5:48 AM, Christian Ziegler chris.zieg...@me.com wrote: Hi all, once again I got a rather general question: Say we got some view-elements which we don't wanna change in any way. We only need to read their value to compute something. Would you create IBOutlets or properties + binding in that case? Those values are not part of my model. They are not being persisted and I only need them temporarily to compute stuff. Thanks in advance, Chris ___ 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/chris.ziegler%40me.com This email sent to chris.zieg...@me.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: IBOutlets or property + binding
On Nov 19, 2009, at 10:32 AM, Christian Ziegler wrote: For instance I got a NSStepper and I only need the integerValue of that stepper. I could either define an IBOutlet and access the integerValue with [stepper integerValue], or I could define a property and bind the steppers value to it. As I mentioned I don't have to manipulate that stepper in any way, I really only need the value. I just wanna know what's best practice. Bindings are generally used to synchronize between a model object and view. When considering a one-way actions, I generally use IBOutlets to manipulate a view, but use target-action for passive activities. So, if it were me, and all I cared about was what value an NSStepper was set to, I would just set the target/action to my controller object and read the value in the action. Although in this case I would set autorepeat to NO so my method is only called once. HTH, Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: IBOutlets or property + binding
Arghh... I was beaten to an answer! :) Slow typing... Yeah, with bindings you will get a two-way connection. If you change your property's value programmatically, the stepper will update also. Instead of target-action you could set up an iboutleted property, connect stepper to it and observe that property for changes. This may be a more cumbersome approach in this case though. Karolis On Thu, Nov 19, 2009 at 11:45 AM, Keary Suska cocoa-...@esoteritech.comwrote: On Nov 19, 2009, at 10:32 AM, Christian Ziegler wrote: For instance I got a NSStepper and I only need the integerValue of that stepper. I could either define an IBOutlet and access the integerValue with [stepper integerValue], or I could define a property and bind the steppers value to it. As I mentioned I don't have to manipulate that stepper in any way, I really only need the value. I just wanna know what's best practice. Bindings are generally used to synchronize between a model object and view. When considering a one-way actions, I generally use IBOutlets to manipulate a view, but use target-action for passive activities. So, if it were me, and all I cared about was what value an NSStepper was set to, I would just set the target/action to my controller object and read the value in the action. Although in this case I would set autorepeat to NO so my method is only called once. HTH, Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Keeping NSView square
On Thu, Nov 19, 2009 at 12:22 AM, Andrew Farmer andf...@gmail.com wrote: To be more specific - I wasn't suggesting adjusting the size of the view at draw time, or refusing to draw the entire dirty rect, but simply performing the min(frame width, frame height) calculation at draw time and drawing the view's content into the minimized rect. -resizeWithOldSuperviewSize: sounds like an excellent alternative, though, and probably more on-target. Oooh, that's a lot less bad. :) --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: setToolTip: not working
On 19-Nov-09, at 7:46 AM, Andy Lee wrote: ...I just did a quick test with an NSButton and a trivial custom view, and it worked. It also worked when I replaced TestView below with NSView. - (void)awakeFromNib { NSWindow *testWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(100, 100, 500, 500) styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:NO]; [testWindow makeKeyAndOrderFront:self]; NSButton *testButton = [[NSButton alloc] initWithFrame:NSMakeRect(100, 50, 100, 20)]; [testButton setTitle:@Hover Over Me]; [testButton sizeToFit]; [testButton setToolTip:@This is an NSButton]; [[testWindow contentView] addSubview:testButton]; NSView *testView = [[TestView alloc] initWithFrame:NSMakeRect(100, 100, 100, 20)]; [testView setToolTip:@This is a test view]; [[testWindow contentView] addSubview:testView]; } Maybe you can temporarily add similar lines to your code and see if you see tooltips? Now we're getting somewhere. I thought my app's code was simple enough that it essentially represented a simple test case, but of course I was wrong. If I put Andy's code in as the -awakeFromNib for my app delegate, the tooltip works fine. But if I copy and paste his button creation code into my NSDocument subclass's - windowControllerDidLoadNib: method, it does not work. That gave me some traction. After commenting out various chunks of my code, I have narrowed it down to a call that I make at the end of my windowControllerDidLoadNib: method: [window setContentSize:NSMakeSize(...)]; If I comment out this line, then the tooltip works. Aha. This led me to suspect the custom NSView subclass that I am using as a content view, and indeed, if I use that custom subclass as the content view in Andy's code, it breaks the tooltip there too. So now we have: @interface AKDocumentContentView : NSView { } @end @implementation AKDocumentContentView - (BOOL)isFlipped { return YES; } @end - (void)awakeFromNib { NSWindow *testWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(100, 100, 500, 500) styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:YES]; NSRect contentFrame = [[testWindow contentView] frame]; AKDocumentContentView *newContentView = [[AKDocumentContentView alloc] initWithFrame:contentFrame]; [testWindow setContentView:newContentView]; NSButton *testButton = [[NSButton alloc] initWithFrame:NSMakeRect(100, 50, 100, 20)]; [testButton setTitle:@Hover Over Me]; [testButton sizeToFit]; [testButton setToolTip:@This is an NSButton]; [[testWindow contentView] addSubview:testButton]; NSView *testView = [[NSView alloc] initWithFrame:NSMakeRect(100, 100, 100, 20)]; [testView setToolTip:@This is a test view]; [[testWindow contentView] addSubview:testView]; [testWindow setContentSize:NSMakeSize(500, 600)]; [testWindow makeKeyAndOrderFront:self]; } Commenting out the -setContentSize: call makes the tooltip work. Commenting out the three-line block that replaces the window's content view with the custom subclass makes the tooltip work. But if both sections of code are live, as above, then the tooltip is broken. Changing -isFlipped to return NO, however, makes the tooltip work again. Also, moving the setToolTip: call to be after the - setContentSize: call makes the tooltip work. So it appears that when you set a tooltip on a view that is inside a flipped content view, and then set a new content size for the window, the tooltip gets lost somehow. The only reason I could think of why this could be my fault was that my content view was not resizing to fit the window properly, because of its springs; but I added a -drawRect: call to it that just frames [self bounds], and it is correctly resizing to continue to fit the window, so that is not the issue. Adding NSResizableWindowMask to the window's style mask is also interesting. In this case, if the -setContentSize: call is commented out, the tooltip starts out working and stays working even when the user resizes the window. But if the -setContentSize: call is left in, the tooltip starts out broken and remains broken, even after the user resizes the window. So whatever the issue is with -setContentSize:, it is persistent. So, is this a bug in AppKit, or are content
Re: firstResponder KVO snow leopard crash; bug?
On Nov 18, 2009, at 5:06 PM, Sean McBride wrote: On 11/18/09 9:00 AM, Corbin Dunn said: Oh -- another thing. Does your subclass of NSCollectionView override: (void)viewWillMoveToWindow:(NSWindow *)window { but not call super? If not... call super! Your classes should always call super if it is defined in a superclass, unless you have a good reason to hide the super's behavior. Corbin, This comment caught by eye. As a general principle, I certainly agree with your comment. But I never call super when I override those methods, and I guess I should be doing so. Does NSView's implementation do something or only NSCollectionView? Only NSCollectionView. But, that is a good question; how would one know they should call super? In general, I think people should *always* call super, unless they have some specific reason not to. Assuming that super may or may not do anything is simply an implementation detail -- in the future we may add code that does something. Maybe for this case we should add the declaration to NSCollectionView and state that it overrides the method to do more work. The .NET framework tends to do this to let people know when that happens, and it might be nice for AppKit to do it too. The docs often comment about calling super. In NSView's case, they do for beginDocument, beginPageInRect:atPlacement:, drawRect:, endDocument, viewWillStartLiveResize, etc. but they don't for the viewWillMoveToWindow:. I guess I'm so used to seeing a comment, that if I don't see one, I don't call super. At least one Apple example also doesn't: http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/ EventOverview/MouseTrackingEvents/MouseTrackingEvents.html Should one call super for all the viewWill/Did methods? My opinion is yes. Please log a documentation bug asking to be clarified (you can copy my email into it). corbin ___ 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: Help with Background Tasks
List, OK to make my request a little more detailed. In my tableview cell for row at index path method I make several URL requests that fill in a cell within a section. E.G section 1 - row 1 (1st url request) section 1 - row 2 (2nd URL request), etc... section 2 - row 1 (URL request Same as url request in section 1 but different data supplied) section 2 - row 2 (URL request Same as url request in section 1 but different data supplied) Obviously I want each URL request as it ends to update the correct index path table cell. I would like to send index path as one of the parameters so that when I perform the selector in background. I can modify that specific cell with that result. The method below only allows me one object, I'm not sure if the withObject:withObject: method will sole the problem if i create a compound selector with the @selector. [self performSelectorInBackground:@selector(MakeURLRequest:) withObject:URLRequest]; All that said I would like to use URLconnection instead (as jens points out) they are asynch but again I have the problem of allocating the responses back to the correct index path object. Jens, Thanks.. On Nov 18, 2009, at 2:35 PM, Jens Alfke wrote: On Nov 18, 2009, at 11:21 AM, Mark Bateman wrote: I am developing an App with a table that will hold URL content. I want to download that in the background and then have it update the table as it arrives. Don't do this using threads. Cocoa's networking APIs are asynchronous, so you can start a download using NSURLConnection and it will run in the background and notify your delegate when it's complete. You almost never need to start threads in Cocoa programming. This can be hard to adjust to if you come from other frameworks, esp. Java. —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: firstResponder KVO snow leopard crash; bug?
On Nov 18, 2009, at 5:28 PM, Aaron Clarke wrote: On Nov 18, 2009, at 12:00 , Corbin Dunn wrote: On Nov 17, 2009, at 1:04 PM, Aaron Clarke wrote: We have an application that runs fine on leopard (10.5) but occasionally crashes on snow leopard (10.6) when closing an NSWindow. Here is the backtrace for the crash: Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x 0x976e691b in objc_msgSend () (gdb) bt #0 0x976e691b in objc_msgSend () #1 0x197142d0 in ?? () #2 0x9031e88e in NSKeyValuePushPendingNotificationPerThread () #3 0x9031e224 in NSKeyValueWillChange () #4 0x9030350b in -[NSObject(NSKeyValueObserverNotification) willChangeValueForKey:] () #5 0x90327cfe in _NSSetObjectValueAndNotify () #6 0x92745fb8 in -[NSWindow makeFirstResponder:] () ... Even if it doesn't crash, closing the NSWindow always results in the following error message. An instance 0x11b75230 of class MyWindow was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info: NSKeyValueObservationInfo 0x19408190 ( NSKeyValueObservance 0x194233d0: Observer: 0x463afa0, Key path: firstResponder, Options: New: YES, Old: NO, Prior: NO Context: 0x0, Property: 0x4453e60 NSKeyValueObservance 0x1ab6ad40: Observer: 0x19427a80, Key path: firstResponder, Options: New: YES, Old: NO, Prior: NO Context: 0x0, Property: 0x4453e60 ) I looked at what the observer object's class is, and it's a subclass of NSCollectionView. We do not explicitly setup a KVO relationship for firstResponder. I also noticed that the Application Kit Release Notes for Snow Leopard mention that firstResponder is KVO-compliant, which makes me believe this is something new in Snow Leopard. All this information makes me believe this is potentially a bug in Application Kit for 10.6. Maybe we setup an NSCollectionView incorrectly or I'm misinterpreting this information? Oh -- another thing. Does your subclass of NSCollectionView override: (void)viewWillMoveToWindow:(NSWindow *)window { but not call super? If not... call super! Your classes should always call super if it is defined in a superclass, unless you have a good reason to hide the super's behavior. corbin This was the problem, thank you. This is a difficult bug to find in code someone else wrote. This makes me almost wish there was a gcc flag for it (-Woverride-no-super). FWIW, this is a compatibility problem we (AppKit) try to avoid. An update to the OS shouldn't break one's app. Right now it is (obviously) too late to change AppKit for SnowLeopard, but please do log a bug so we can do something about it (it will probably amount to a tech note or release note or documentation change for NSCollectionView). corbin ___ 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
Custom Tableview cell and grouped tables
Hi, I have created a custom tableview cell and it works great, but when I choose the grouped view in the tableview nothing happens, what have I missed. ___ 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: Custom Tableview cell and grouped tables
On 19 Nov 2009, at 12:45 PM, Mark Bateman wrote: I have created a custom tableview cell and it works great, but when I choose the grouped view in the tableview nothing happens, what have I missed. You've told us next to nothing, so you really haven't asked a question. I can infer that you're talking about UITableView and UITableViewCell in the iPhone OS, but it's hard to tell. You don't actually say. Cocoa runs on both the iPhone OS and Mac OS X. You should say which. What do you mean nothing happens? They don't draw? They take up space but are blank? They don't respond to touches? Their subviews don't behave as expected? They didn't respond to table-editing gestures? What did you expect to happen? When it worked great, did the table have sections? When you changed to the grouped style, did you add sections, and are you sure you're accounting for them? Have you done anything for yourself to debug your problem? Have you run the app with the debugger? Have you set breakpoints in the relevant methods? Does anything show up in the Debugger Log? http://whathaveyoutried.com/ — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Custom Tableview cell and grouped tables
1. this is iphone 2. after i change the UItableview style to the grouped style the table continues to show as before a regular table with my custom cells but the tableview is not in the grouped style. hope that makes my question much clearer. On Nov 19, 2009, at 2:10 PM, Fritz Anderson wrote: On 19 Nov 2009, at 12:45 PM, Mark Bateman wrote: I have created a custom tableview cell and it works great, but when I choose the grouped view in the tableview nothing happens, what have I missed. You've told us next to nothing, so you really haven't asked a question. I can infer that you're talking about UITableView and UITableViewCell in the iPhone OS, but it's hard to tell. You don't actually say. Cocoa runs on both the iPhone OS and Mac OS X. You should say which. What do you mean nothing happens? They don't draw? They take up space but are blank? They don't respond to touches? Their subviews don't behave as expected? They didn't respond to table-editing gestures? What did you expect to happen? When it worked great, did the table have sections? When you changed to the grouped style, did you add sections, and are you sure you're accounting for them? Have you done anything for yourself to debug your problem? Have you run the app with the debugger? Have you set breakpoints in the relevant methods? Does anything show up in the Debugger Log? http://whathaveyoutried.com/ — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Custom Tableview cell and grouped tables
You can't change the style of a table after it's been created. Only place to set the table's style is initWithFrame:style: Luke On Nov 19, 2009, at 11:17 AM, Mark Bateman wrote: 1. this is iphone 2. after i change the UItableview style to the grouped style the table continues to show as before a regular table with my custom cells but the tableview is not in the grouped style. hope that makes my question much clearer. On Nov 19, 2009, at 2:10 PM, Fritz Anderson wrote: On 19 Nov 2009, at 12:45 PM, Mark Bateman wrote: I have created a custom tableview cell and it works great, but when I choose the grouped view in the tableview nothing happens, what have I missed. You've told us next to nothing, so you really haven't asked a question. I can infer that you're talking about UITableView and UITableViewCell in the iPhone OS, but it's hard to tell. You don't actually say. Cocoa runs on both the iPhone OS and Mac OS X. You should say which. What do you mean nothing happens? They don't draw? They take up space but are blank? They don't respond to touches? Their subviews don't behave as expected? They didn't respond to table-editing gestures? What did you expect to happen? When it worked great, did the table have sections? When you changed to the grouped style, did you add sections, and are you sure you're accounting for them? Have you done anything for yourself to debug your problem? Have you run the app with the debugger? Have you set breakpoints in the relevant methods? Does anything show up in the Debugger Log? http://whathaveyoutried.com/ — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com This email sent to luket...@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: Help with Background Tasks
On Nov 19, 2009, at 10:42 AM, Mark Bateman wrote: All that said I would like to use URLconnection instead (as jens points out) they are asynch but again I have the problem of allocating the responses back to the correct index path object. Each NSURLRequest can have its own delegate. Store any per-request info you need, like the index path, in the delegate. For example, make an NSIndexPath instance variable and set that in the init method. Then create a new delegate object for each request. Alternatively, if your object model already has a custom object per item, just use that object as the delegate by adding the appropriate callback methods to it. —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: Custom Tableview cell and grouped tables
I'm referring to changing the style in the NIB prior to compiling, not on the fly in the application, if that helps. On Nov 19, 2009, at 2:19 PM, Luke the Hiesterman wrote: You can't change the style of a table after it's been created. Only place to set the table's style is initWithFrame:style: Luke On Nov 19, 2009, at 11:17 AM, Mark Bateman wrote: 1. this is iphone 2. after i change the UItableview style to the grouped style the table continues to show as before a regular table with my custom cells but the tableview is not in the grouped style. hope that makes my question much clearer. On Nov 19, 2009, at 2:10 PM, Fritz Anderson wrote: On 19 Nov 2009, at 12:45 PM, Mark Bateman wrote: I have created a custom tableview cell and it works great, but when I choose the grouped view in the tableview nothing happens, what have I missed. You've told us next to nothing, so you really haven't asked a question. I can infer that you're talking about UITableView and UITableViewCell in the iPhone OS, but it's hard to tell. You don't actually say. Cocoa runs on both the iPhone OS and Mac OS X. You should say which. What do you mean nothing happens? They don't draw? They take up space but are blank? They don't respond to touches? Their subviews don't behave as expected? They didn't respond to table-editing gestures? What did you expect to happen? When it worked great, did the table have sections? When you changed to the grouped style, did you add sections, and are you sure you're accounting for them? Have you done anything for yourself to debug your problem? Have you run the app with the debugger? Have you set breakpoints in the relevant methods? Does anything show up in the Debugger Log? http://whathaveyoutried.com/ — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com This email sent to luket...@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: Custom Tableview cell and grouped tables
You should post a sample project demonstrating your problem. Saying you're changing the style in the nib and it's not being reflected in the app isn't a whole lot to go on. Luke On Nov 19, 2009, at 11:23 AM, Mark Bateman wrote: I'm referring to changing the style in the NIB prior to compiling, not on the fly in the application, if that helps. On Nov 19, 2009, at 2:19 PM, Luke the Hiesterman wrote: You can't change the style of a table after it's been created. Only place to set the table's style is initWithFrame:style: Luke On Nov 19, 2009, at 11:17 AM, Mark Bateman wrote: 1. this is iphone 2. after i change the UItableview style to the grouped style the table continues to show as before a regular table with my custom cells but the tableview is not in the grouped style. hope that makes my question much clearer. On Nov 19, 2009, at 2:10 PM, Fritz Anderson wrote: On 19 Nov 2009, at 12:45 PM, Mark Bateman wrote: I have created a custom tableview cell and it works great, but when I choose the grouped view in the tableview nothing happens, what have I missed. You've told us next to nothing, so you really haven't asked a question. I can infer that you're talking about UITableView and UITableViewCell in the iPhone OS, but it's hard to tell. You don't actually say. Cocoa runs on both the iPhone OS and Mac OS X. You should say which. What do you mean nothing happens? They don't draw? They take up space but are blank? They don't respond to touches? Their subviews don't behave as expected? They didn't respond to table- editing gestures? What did you expect to happen? When it worked great, did the table have sections? When you changed to the grouped style, did you add sections, and are you sure you're accounting for them? Have you done anything for yourself to debug your problem? Have you run the app with the debugger? Have you set breakpoints in the relevant methods? Does anything show up in the Debugger Log? http://whathaveyoutried.com/ — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/luketheh %40apple.com This email sent to luket...@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
NSTextView, Bindings, and Display Updates
Hi All, I'm having a strange behavior with an NSTextView bound through Interface Builder to a Core Data backing. The textView is part of a standard master-detail setup, and is not updating its value when the selection is changed in the master list. The value only displays after the mouse has entered the textView's frame. It stays there until the master selection changes, at which point I have to wave the mouse through it to get the new value to appear. Any ideas? Thanks so much, Andy Shamel___ 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
Trouble finding bounding rect of NSAttributedString
Hi everyone, I've been struggling for several hours to get the bounding rectangle of an NSAttributedString when drawn at a particular width. I have an NSTextView that I need to resize dynamically. NSTextView appears to resize itself as I add text, but I also need it to shrink itself as I delete text. Here's what I've tried: [myAttributedString size] [myAttributedString boundingRectWithSize:NSMakeSize(desiredWidth, FLT_MAX) options:NSStringDrawingUsesDeviceMetrics]; [[myTextView layoutManager] usedRectForTextContainer:[myTextView textContainer]] [[myTextView layoutManager] boundingRectForGlyphRange:NSMakeRange(0, [myAttributedString length]) inTextContainer:[myTextView textContainer]] ... and a few others I've been over the documentation for NSAttributedString, NSLayoutManager, and NSTextContainer, and I've tried just about everything that looks like it might give me what I'm looking for. However, I've obviously missed something pretty fundamental to getting my string's rect. Any pointers? Thanks! Dave DeLong smime.p7s Description: S/MIME cryptographic signature ___ 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: IBOutlets or property + binding
target/action is inappropriate since no action is needed at the time the value was changed. Instead, once the user clicks a button I compute something hence I read the values from the steppers and stuff. But that doesn't change much does it :) Cheers, Chris On 19.11.2009, at 18:51, Karolis Ramanauskas wrote: Arghh... I was beaten to an answer! :) Slow typing... Yeah, with bindings you will get a two-way connection. If you change your property's value programmatically, the stepper will update also. Instead of target-action you could set up an iboutleted property, connect stepper to it and observe that property for changes. This may be a more cumbersome approach in this case though. Karolis On Thu, Nov 19, 2009 at 11:45 AM, Keary Suska cocoa-...@esoteritech.comwrote: On Nov 19, 2009, at 10:32 AM, Christian Ziegler wrote: For instance I got a NSStepper and I only need the integerValue of that stepper. I could either define an IBOutlet and access the integerValue with [stepper integerValue], or I could define a property and bind the steppers value to it. As I mentioned I don't have to manipulate that stepper in any way, I really only need the value. I just wanna know what's best practice. Bindings are generally used to synchronize between a model object and view. When considering a one-way actions, I generally use IBOutlets to manipulate a view, but use target-action for passive activities. So, if it were me, and all I cared about was what value an NSStepper was set to, I would just set the target/action to my controller object and read the value in the action. Although in this case I would set autorepeat to NO so my method is only called once. HTH, Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/chris.ziegler%40me.com This email sent to chris.zieg...@me.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: Core Data: Simply set NSMigratePersistentStoresAutomaticallyOption in a Document?
P.S. Sorry if this is in the list archives but since cocoabuilder.com is down I'm searching lists.apple.com. Searching with Search for: NSMigratePersistentStoresAutomaticallyOption Match: All Find: Substring Located In: Whole Document Listname Matches: cocoa-dev I get: Sorry, your search for NSMigratePersistentStoresAutomaticallyOption did not find any results. No documents were found containing NSMigratePersistentStoresAutomaticallyOption. Seems unbelievable. I can't help with your question but Googling NSMigratePersistentStoresAutomaticallyOption site:lists.apple.com yields 36 results. There's probably several duplicates but it give you a head start Matt ___ 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: Trouble finding bounding rect of NSAttributedString
On Nov 19, 2009, at 1:28 PM, Dave DeLong wrote: I have an NSTextView that I need to resize dynamically. NSTextView appears to resize itself as I add text, but I also need it to shrink itself as I delete text. Here's what I've tried: Several of those look like reasonable calls for this purpose. You didn't specify what went wrong when you called 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: Trouble finding bounding rect of NSAttributedString
Good point. When I print out the size or rect that these return, I invariably get either {0, 0} or something absurd like {{1.17076e-318, 2.29357e-314}, {2.30359e-314, 2.1224e-314}} (that's just running the rect through NSStringFromRect()) Dave On Nov 19, 2009, at 3:37 PM, Jens Alfke wrote: On Nov 19, 2009, at 1:28 PM, Dave DeLong wrote: I have an NSTextView that I need to resize dynamically. NSTextView appears to resize itself as I add text, but I also need it to shrink itself as I delete text. Here's what I've tried: Several of those look like reasonable calls for this purpose. You didn't specify what went wrong when you called them ... ? —Jens smime.p7s Description: S/MIME cryptographic signature ___ 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
Authorization plugin samples
Hi, I am not sure this is the right list for this question. If it is not, I aplologize, and ask which list should I address ? I am trying to wrtie a daemon for OS X that will be given user credentials and automatically login the user. I know it can be done using AppleScript, but this sometimes gave me problems. It was suggested to me (on stackoverflow.com) that I should write an Authorization Pluginhttp://developer.apple.com/mac/library/documentation/Security/Reference/AuthorizationPluginRef/Reference/reference.html#//apple_ref/doc/uid/TP40001432-CH1g-438261. While the documentation is interesting, where can I find a small sample plugin to reference ? Regards Alan J. Caruana ___ 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
ColorSyncDeprecated.h in OSX - 10.6
Hi, Does anyone have any idea where the new functions for ColorSyncManager (presumably 64bit focused) are documented? The only information I can find lists the new functions but does not document them. (Application Services Reference Update. dated 2009-8-28 lists the names but has no reference links to either the complete description or reference documentation.) The ColorSync.framework (C-)headers are completely changed from the earlier X-Code /Leopard release In addition to this, a huge number of fundamental ICC elements seem to be probably(?) deprecated now. (I am making the dprecation assumption although I can find no specific record in anything except headers = In X-code 3.2.1 they are now shown in a new header file labelled ColorSyncDeprecated.h.) Worryingly, the (probably?) deprecated elements include a large quantity of 'enum's which are fundamental elements in ICC versions from at least 2.1 onwards. I have seen some info on data 'type' issues with 'enum's in 64bit code in 64 bit Transition Guide for Cocoa. An updated version of ColorSyncManager reference is a possible missing link (last update was 2005). Are we just seeing Apple getting a bit ahead of themselves with the early SnowLeopard release and not tying up the loose-ends in ColorSync for X-Code? A link to the new documentation or even just a date for the documentation release would be helpful (Apple please?) Simon___ 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
NSStatusItem with agent
Hi I am developing launch agent which creates NSStatusItem. When I am launching my agent by myself using launchctl load com.company.MyAgent.plist then I dont have any problem, I see NSStatusItem in menu bar and I can set focus on it. If I put my agent to /System/Library/LaunchAgents and restart computer, then after restart I cant set focus( I am clicking on it) on my NSStatusItem. All other functionality of my agent is working. This is how I create my NSStatusItem: g_autoReleasePool = [[NSAutoreleasePool alloc] init]; // pool is created NSApplicationLoad(); // Get a status item. NSStatusBar *bar = [NSStatusBar systemStatusBar]; NSStatusItem* theItem = [bar statusItemWithLength:NSVariableStatusItemLength]; [theItem retain]; [theItem setTitle: NSLocalizedString(@Tablet,@)]; [theItem setHighlightMode:YES]; Am I doing something wrong? 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
Controlling cocoa windows hit test
Hi, I'm looking for a way to control hit testing on a cocoa transparent window. The default behavior, as I understood it, is that if a pixel is not entirely transparent, then the click occured in the window. I would like to have more control over this, so a click in my custom drop shadow don't cause my window to become key. Can you think of a way/hack to make this happen, something like kEventWindowHitTest in carbon ? Thanks, Tristan ___ 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
need to find exact WiFi encryption method
Hi, I have used securityMode method in CWNetwork class of CoreWLAN framework to find the encryption used in the current Airport WiFi connection. I am getting return value kCWSecurityModeWPA_PSK. My problem is I have 2 WiFi network, 1) WPA - PSK - TKIP 2) WPA - PSK - AES But the Mac securityMode API is having only one return value for both these network ie kCWSecurityModeWPA_PSK. The same is with WPA2 also. IF any one knows a way to find the exact type of encryption used in WiFi Airport connection , Please let us know as soon as possible. I have tried to find in preference files, but every were its written as WPA - PSK only, no where I am able to find what type of encryption exactly is used ie TKIP or AES . With Best Regards, Pappan ___ 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 to change TCP / IP settings using Cocoa
Hi, I need to know the current TCP / IP configuration setting Configure IPv4 of current WiFi connection and change this settings from Using DHCP to Manually and configure IP settings like IPaddress and subnet using Cocoa API. If some body can share some inputs on this, I will be a great help. regards Pappan ___ 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
Job Posting: Experienced Cocoa Developer (full time position, New York City
Boxwork is seeking an experienced Cocoa Developer to augment its software team. The developer will work mainly with the Cocoa API developing software for the Mac OS X platform.. Responsibilities: • Participate in design activities with team members • Discuss requirements with end users • Implement, test, debug, document and integrate new User Interface components into existing code base Requirements: • Very good knowledge of Cocoa/Objective-C, at least 2 year experience • Ability to work on-location in Manhattan (no off-site consultants please) Useful experience: • Subversion or git Job Benefits (beside the industry standards): • Be part of a small team of experienced MacOS X developers who enjoy creative freedom. • Work in a large, bright Manhattan office, with latest fast equipment 30 Monitors, MacPro, etc). • Contribute to an exciting product that will be publicly launched to change the world of digital photography. Who is Boxwork: Boxwork is the digital division of Box, a multimedia company founded by Pascal Dangin that combines technical innovation and artistic sensibility. Using customized tools we offer a full suite of creative services: capture, finishing, prepress, printing, publishing, archiving and creative. The comprehensive experience of Box helps clients to promote their brands through a cohesive strategy throughout all types of media. Our work regularly appears on the covers and pages of major publications, fine art books, museums, television networks and online, as well as some of the world's leading advertising campaigns. Boxwork includes an internal research and development team that acts as a think tank to create novel solutions for internal and external production and administrative challenges. Our expert programmers, engineers and technicians work side by side to quickly turn ideas into realities. As a result we have several software and hardware products that have given us a range of tools to address digital capture, asset management, workflow oversight and color management. We see these tools as a differentiator that keeps Box continually on the forefront of the industry. Please send your resumes to: boxworkj...@boxstudios.com Boxwork (a division of Box) 412 West 14th street New York, NY 10014 On moderator request: all replies to this e-mail off-list please. ___ 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: NSRunloop + shared thread
On Nov 19, 2009, at 2:54 PM, Colin Deasy wrote: I have a shared thread that is used to process multiple asynchronous tasks. But at some point, a task may need to 'pause' its execution, and cannot exit its method and wait to be re-called, how can I do this? They're not really asynchronous tasks if they need to block. You might try to refactor your design so nothing blocks — this usually involves converting local state inside a method, into state in an object's instance variables. If you can limit yourself to 10.6, using blocks can help a lot in this. In that method, where a 'pause' instance is brought about, can I use something like the following to wait, but not block the run loop? while(condition)[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalFromNow:0.01]]; The short answer is yes. The full answer is that while this is tempting, and it can be made to work, it enables complicated forms of re-entrancy that can produce very unexpected results that are hard to debug. The problem is that external state can change out from underneath your handler while it's waiting like this, as other handlers run. You can even get the same handler invoked in nested form. Or you can get the opposite problem, where the outer handler sets some state (such as acquiring a lock) that breaks other nested handlers when they try to access the same state. Several times I've managed to catch a crash, then scrolled down the call stack and gone oh shit! as I see the multiple layers of handlers. I would recommend you not go this route. —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: How to change TCP / IP settings using Cocoa
On Nov 19, 2009, at 9:17 AM, Padmakumar T V wrote: I need to know the current TCP / IP configuration setting Configure IPv4 of current WiFi connection and change this settings from Using DHCP to Manually and configure IP settings like IPaddress and subnet using Cocoa API. SystemConfiguration.framework, probably. This is not a Cocoa API; you should use the macnetworkprog mailing list to ask questions after you read the docs. —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: Trouble finding bounding rect of NSAttributedString
On Nov 19, 2009, at 2:39 PM, Dave DeLong wrote: When I print out the size or rect that these return, I invariably get either {0, 0} or something absurd like {{1.17076e-318, 2.29357e-314}, {2.30359e-314, 2.1224e-314}} (that's just running the rect through NSStringFromRect()) Make sure the receiver (the NSAttributedString) isn't nil. The Obj-C runtime gives undefined results for a struct-based method return value if the receiver is nil; so you'll end up with garbage like this. (This is because it doesn't know at runtime how large the struct is, so it can't safely fill it in with zeroes.) Put in something like NSAssert(str!=nil, @str is nil); before the call. —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: NSRunloop + shared thread
I see what you mean but at the moment Im finding it hard to see another avenue. To give a bit more detail on the situation. This shared thread is actually handling potentially large numbers of concurrent url connections/downloads. The reason that I want a block in some of those at different times is a for a form of bandwidth control I am trying to do. I know I could do this by having a separate thread for each task but there is quite a lot of overhead with that and from the tests I have ran, it spins too much. Subject: Re: NSRunloop + shared thread From: j...@mooseyard.com Date: Thu, 19 Nov 2009 15:21:37 -0800 CC: cocoa-dev@lists.apple.com To: colde...@hotmail.com On Nov 19, 2009, at 2:54 PM, Colin Deasy wrote: I have a shared thread that is used to process multiple asynchronous tasks. But at some point, a task may need to 'pause' its execution, and cannot exit its method and wait to be re-called, how can I do this? They're not really asynchronous tasks if they need to block. You might try to refactor your design so nothing blocks — this usually involves converting local state inside a method, into state in an object's instance variables. If you can limit yourself to 10.6, using blocks can help a lot in this. In that method, where a 'pause' instance is brought about, can I use something like the following to wait, but not block the run loop? while(condition)[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalFromNow:0.01]]; The short answer is yes. The full answer is that while this is tempting, and it can be made to work, it enables complicated forms of re-entrancy that can produce very unexpected results that are hard to debug. The problem is that external state can change out from underneath your handler while it's waiting like this, as other handlers run. You can even get the same handler invoked in nested form. Or you can get the opposite problem, where the outer handler sets some state (such as acquiring a lock) that breaks other nested handlers when they try to access the same state. Several times I've managed to catch a crash, then scrolled down the call stack and gone oh shit! as I see the multiple layers of handlers. I would recommend you not go this route. —Jens _ New Windows 7: Find the right PC for you. Learn more. http://windows.microsoft.com/shop___ 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
Advice about crash requested
I've got a user getting the following crash, and I don't know what to make of it because it all happens in Apple code. Has anyone got any advice? Process: XXX [242] Path:/Applications/XXX.app/Contents/MacOS/XXX Identifier: XXX Version: 1.19 (19) Code Type: X86-64 (Native) Parent Process: launchd [180] Date/Time: 2009-11-15 23:34:52.052 -0500 OS Version: Mac OS X 10.6.2 (10C540) Report Version: 6 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x000b Crashed Thread: 0 Dispatch queue: com.apple.main-thread Application Specific Information: objc_msgSend() selector name: invalidate NSTextAttachmentImageView objc[242]: garbage collection is ON Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x7fff85a4210a objc_msgSend + 22 1 com.apple.AppKit 0x7fff8169871e -[NSImageCell(NSPrivateAnimationSupport) _stopAnimation] + 43 2 com.apple.AppKit 0x7fff819b60c2 -[NSImageView finalize] + 26 3 libobjc.A.dylib 0x7fff85a48f67 finalizeOneObject + 48 4 libauto.dylib 0x7fff85b113d5 Auto::foreach_block_do(auto_zone_cursor*, void (*)(void*, void*), void*) + 85 5 libobjc.A.dylib 0x7fff85a48b5c batchFinalize + 64 6 libobjc.A.dylib 0x7fff85a48e00 batchFinalizeOnMainThread + 87 7 libSystem.B.dylib 0x7fff879e3ce8 _dispatch_call_block_and_release + 15 8 libSystem.B.dylib 0x7fff879c287a _dispatch_queue_drain + 251 9 libSystem.B.dylib 0x7fff879c3127 _dispatch_queue_serial_drain_till_empty + 9 10 libSystem.B.dylib 0x7fff879f5e4c _dispatch_main_queue_callback_4CF + 37 11 com.apple.CoreFoundation 0x7fff86c99b00 __CFRunLoopRun + 2560 12 com.apple.CoreFoundation 0x7fff86c98c2f CFRunLoopRunSpecific + 575 13 com.apple.HIToolbox 0x7fff865b9a4e RunCurrentEventLoopInMode + 333 14 com.apple.HIToolbox 0x7fff865b9853 ReceiveNextEventCommon + 310 15 com.apple.HIToolbox 0x7fff865b970c BlockUntilNextEventMatchingListInMode + 59 16 com.apple.AppKit 0x7fff815f31f2 _DPSNextEvent + 708 17 com.apple.AppKit 0x7fff815f2b41 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 155 18 com.apple.AppKit 0x7fff815b8747 -[NSApplication run] + 395 19 XXX 0x00010eea main + 76 20 XXX 0x00010e7c start + 52 Thread 1: Dispatch queue: com.apple.libdispatch-manager 0 libSystem.B.dylib 0x7fff879c0bba kevent + 10 1 libSystem.B.dylib 0x7fff879c2a85 _dispatch_mgr_invoke + 154 2 libSystem.B.dylib 0x7fff879c275c _dispatch_queue_invoke + 185 3 libSystem.B.dylib 0x7fff879c2286 _dispatch_worker_thread2 + 244 4 libSystem.B.dylib 0x7fff879c1bb8 _pthread_wqthread + 353 5 libSystem.B.dylib 0x7fff879c1a55 start_wqthread + 13 Thread 2: 0 libSystem.B.dylib 0x7fff879a7e3a mach_msg_trap + 10 1 libSystem.B.dylib 0x7fff879a84ad mach_msg + 59 2 com.apple.CoreFoundation 0x7fff86c997a2 __CFRunLoopRun + 1698 3 com.apple.CoreFoundation 0x7fff86c98c2f CFRunLoopRunSpecific + 575 4 com.apple.Foundation 0x7fff82021a24 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 270 5 au.com.tech.CocoaTools0x000101f152af -[InfiniteThread main] + 171 6 AutoFilerPlugin 0x00010352040c -[FilerExecutor main] + 72 7 com.apple.Foundation 0x7fff81fe6e99 __NSThread__main__ + 1429 8 libSystem.B.dylib 0x7fff879e0f8e _pthread_start + 331 9 libSystem.B.dylib 0x7fff879e0e41 thread_start + 13 Thread 3: Dispatch queue: Garbage Collection Work Queue 0 libSystem.B.dylib 0x7fff879e29ee __semwait_signal + 10 1 libSystem.B.dylib 0x7fff879e67f1 _pthread_cond_wait + 1286 2 libobjc.A.dylib 0x7fff85a48cd8 batchFinalizeOnTwoThreads + 250 3 libauto.dylib 0x7fff85b0b1e7 Auto::Zone::invalidate_garbage(unsigned long, unsigned long const*) + 71 4 libauto.dylib 0x7fff85afbbd1 auto_collect_internal(Auto::Zone*, unsigned int) + 481 5 libauto.dylib 0x7fff85afc16d auto_collection_work(Auto::Zone*) + 157 6 libSystem.B.dylib 0x7fff879e3ce8 _dispatch_call_block_and_release + 15 7 libSystem.B.dylib 0x7fff879c287a _dispatch_queue_drain + 251 8 libSystem.B.dylib 0x7fff879c26dc _dispatch_queue_invoke + 57 9 libSystem.B.dylib 0x7fff879c2286 _dispatch_worker_thread2 + 244 10 libSystem.B.dylib 0x7fff879c1bb8 _pthread_wqthread + 353 11
Re: Advice about crash requested
On Nov 19, 2009, at 4:18 PM, Chris Idou wrote: I've got a user getting the following crash, and I don't know what to make of it because it all happens in Apple code. Has anyone got any advice? What are you doing on Thread 2 ([FilerExecutor main])? -- 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: NSRunloop + shared thread
On Thu, Nov 19, 2009 at 3:40 PM, Colin Deasy colde...@hotmail.com wrote: I see what you mean but at the moment Im finding it hard to see another avenue. To give a bit more detail on the situation. This shared thread is actually handling potentially large numbers of concurrent url connections/downloads. The reason that I want a block in some of those at different times is a for a form of bandwidth control I am trying to do. I know I could do this by having a separate thread for each task but there is quite a lot of overhead with that and from the tests I have ran, it spins too much. Why are you using threads for this? Cocoa does downloading very well without using threads. --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
tiffs on pasteboard
I'm trying to read a TIFF off the pasteboard, but it doesn't seem to work for me. What I'm doing is going into Finder, finding a TIFF file and Command-C it. Among other types I then find on the pasteboard are: NeXT TIFF v4.0 pasteboard type and public.tiff If I take either of those from the pasteboard and write the NSData object to a file: [content writeToFile:@/tmp/foo.tiffatomically:YES]; or else if I make an NSImage from the data: [[NSImagealloc] initWithData:content] and display it in an NSImageView then I always see the generic TIFF icon, i.e. the one with a photo of a child scattered on the table, with a loupe on top of it. The same thing happens for JPEGs, GIFS and PNGs, but not for com.apple.icns. If I take the com.apple.icns, it displays correctly. What am I doing wrong? __ Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7. Enter now: http://au.docs.yahoo.com/homepageset/ ___ 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: tiffs on pasteboard
On Thu, Nov 19, 2009 at 4:33 PM, Chris Idou idou...@yahoo.com wrote: I'm trying to read a TIFF off the pasteboard, but it doesn't seem to work for me. What I'm doing is going into Finder, finding a TIFF file and Command-C it. You've copied the file icon. If you want to copy the file's data, you need to open it in Preview and copy that. --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: Advice about crash requested
Mainly stuff to do with examining files, and on the odd occasion it needs to do anything in the GUI it executes it on the main thread. From: David Duncan david.dun...@apple.com To: Chris Idou idou...@yahoo.com Cc: cocoa-dev@lists.apple.com Sent: Fri, 20 November, 2009 11:21:58 AM Subject: Re: Advice about crash requested On Nov 19, 2009, at 4:18 PM, Chris Idou wrote: I've got a user getting the following crash, and I don't know what to make of it because it all happens in Apple code. Has anyone got any advice? What are you doing on Thread 2 ([FilerExecutor main])? -- David Duncan Apple DTS Animation and Printing __ Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7. Enter now: http://au.docs.yahoo.com/homepageset/ ___ 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: NSRunloop + shared thread
On Nov 19, 2009, at 3:40 PM, Colin Deasy wrote: This shared thread is actually handling potentially large numbers of concurrent url connections/downloads. The reason that I want a block in some of those at different times is a for a form of bandwidth control I am trying to do. I don't think that will do what you want. The actual socket I/O happens in a background thread owned by CFNetwork; I don't think that thread will stop reading data just because your callback on the main thread hasn't returned yet. It just means that, when you do return, you'll immediately get a bigger chunk of data. I've seen this general question of rate limiting asked on the macnetworkprog list. IIRC the answer is that Foundation and CFNetwork don't really give you the tools to do it. You'd have to write your own code using low-level BSD sockets APIs. :-P —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: Advice about crash requested
On Nov 19, 2009, at 4:18 PM, Chris Idou wrote: Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x7fff85a4210a objc_msgSend + 22 1 com.apple.AppKit 0x7fff8169871e -[NSImageCell(NSPrivateAnimationSupport) _stopAnimation] + 43 2 com.apple.AppKit 0x7fff819b60c2 -[NSImageView finalize] + 26 Looks like NSImageCell is calling a bogus object, probably one that's already been freed. That's sort of unusual for a GC'd app — usually this indicates a ref-counting bug. You're not calling AppKit from a background thread, are you? Turning on NSZombieEnabled might help shed some light on this. There's a So, You've Crashed In objc_msgsend FAQ out there on teh interwebz somewhere that goes into more detail on troubleshooting. —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: Advice about crash requested
On 20/11/2009, at 10:54 AM, Jens Alfke wrote: Turning on NSZombieEnabled might help shed some light on this. There's a So, You've Crashed In objc_msgsend FAQ out there on teh interwebz somewhere that goes into more detail on troubleshooting. I didn't think you could use NSZombieEnabled for GC apps. Can you? -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Advice about crash requested
On 11/19/09 4:54 PM, Jens Alfke said: On Nov 19, 2009, at 4:18 PM, Chris Idou wrote: Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x7fff85a4210a objc_msgSend + 22 1 com.apple.AppKit 0x7fff8169871e -[NSImageCell (NSPrivateAnimationSupport) _stopAnimation] + 43 2 com.apple.AppKit 0x7fff819b60c2 -[NSImageView finalize] + 26 Looks like NSImageCell is calling a bogus object, probably one that's already been freed. That's sort of unusual for a GC'd app -- usually this indicates a ref-counting bug. You're not calling AppKit from a background thread, are you? Turning on NSZombieEnabled might help shed some light on this. It won't, because NSZombieEnabled does nothing in GC apps. :( There's a So, You've Crashed In objc_msgsend FAQ out there on teh interwebz somewhere that goes into more detail on troubleshooting. It's here: http://www.sealiesoftware.com/blog/archive/2008/09/22/ objc_explain_So_you_crashed_in_objc_msgSend.html -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: tiffs on pasteboard
On Nov 19, 2009, at 4:43 PM, Chris Idou wrote: If I double click the tiff in Finder, and open it in Preview, click it in Preview, Command-A, Command-C, the same thing happens. That's weird. Can you show us the code that reads the image data off the pasteboard? —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: tiffs on pasteboard
I notice that at least com.apple.icns works when I copy it from Preview, but it doesn't work when just copying from Finder. But either way TextEdit seems to be able to get the right thing if I paste into it. From: Chris Idou idou...@yahoo.com To: Kyle Sluder kyle.slu...@gmail.com Cc: cocoa-dev@lists.apple.com Sent: Fri, 20 November, 2009 11:43:17 AM Subject: Re: tiffs on pasteboard If I double click the tiff in Finder, and open it in Preview, click it in Preview, Command-A, Command-C, the same thing happens. From: Kyle Sluder kyle.slu...@gmail.com To: Chris Idou idou...@yahoo.com Cc: cocoa-dev@lists.apple.com Sent: Fri, 20 November, 2009 11:36:54 AM Subject: Re: tiffs on pasteboard On Thu, Nov 19, 2009 at 4:33 PM, Chris Idou idou...@yahoo.com wrote: I'm trying to read a TIFF off the pasteboard, but it doesn't seem to work for me. What I'm doing is going into Finder, finding a TIFF file and Command-C it. You've copied the file icon. If you want to copy the file's data, you need to open it in Preview and copy that. --Kyle Sluder __ Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7. Enter now: http://au.docs.yahoo.com/homepageset/ ___ 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/idou747%40yahoo.com This email sent to idou...@yahoo.com __ Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7. Enter now: http://au.docs.yahoo.com/homepageset/ ___ 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: Advice about crash requested
This will help if I'm ever able to repeat it. Right now its just a user report and I can't repeat it. From: Sean McBride s...@rogue-research.com To: Jens Alfke j...@mooseyard.com; Chris Idou idou...@yahoo.com Cc: cocoa-dev@lists.apple.com Sent: Fri, 20 November, 2009 12:03:33 PM Subject: Re: Advice about crash requested On 11/19/09 4:54 PM, Jens Alfke said: On Nov 19, 2009, at 4:18 PM, Chris Idou wrote: Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x7fff85a4210a objc_msgSend + 22 1 com.apple.AppKit 0x7fff8169871e -[NSImageCell (NSPrivateAnimationSupport) _stopAnimation] + 43 2 com.apple.AppKit 0x7fff819b60c2 -[NSImageView finalize] + 26 Looks like NSImageCell is calling a bogus object, probably one that's already been freed. That's sort of unusual for a GC'd app -- usually this indicates a ref-counting bug. You're not calling AppKit from a background thread, are you? Turning on NSZombieEnabled might help shed some light on this. It won't, because NSZombieEnabled does nothing in GC apps. :( There's a So, You've Crashed In objc_msgsend FAQ out there on teh interwebz somewhere that goes into more detail on troubleshooting. It's here: http://www.sealiesoftware.com/blog/archive/2008/09/22/ objc_explain_So_you_crashed_in_objc_msgSend.html -- Sean McBride, B. Engs...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada __ Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7. Enter now: http://au.docs.yahoo.com/homepageset/ ___ 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: tiffs on pasteboard
On Nov 19, 2009, at 5:24 PM, Chris Idou wrote: But I'm still confused about one thing: If copying from Finder actually copies the file icon, and not the actual tiff, how come it pastes ok into TextEdit? The Finder also puts the location of the file on the pasteboard, and I believe TextEdit sees that, recognizes that it's an image file, and reads the file into an image. You can do the same fairly easily. —Jens___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data: Simply set NSMigratePersistentStoresAutomaticallyOption in a Document?
On 2009 Nov 19, at 14:05, Matthew Lindfield Seager wrote: I can't help with your question but Googling NSMigratePersistentStoresAutomaticallyOption site:lists.apple.com yields 36 results. There's probably several duplicates but it give you a head start Hmmm. When I tried that this morning I only got 19. Among the additional 17, I found this: http://lists.apple.com/archives/cocoa-dev/2008/Aug/msg00767.html Summary: There is no need to muck with NSPersistentDocument's built-in and bug-free Persistence Stack. Happy Day! All you do is override -[NSPersistentDocument initWithContentsOfURL:ofType:error:]. I submitted document feedback suggesting this to the Core Data Model Versioning and Data Migration Programming Guide. Thanks, Matthew. The code in that post had issues and didn't quite work, so I fixed it up and it now seems to just work now for all three cases (1) oldest docs saved with old model (2) old docs with new model (3) new docs. In case (1) the old file remains with a tilde suffix, as expected. In case (3), the method doesn't even run. But when it does, it handles errors properly :) So, the answer to the question: How to enable Default Automatic Migration in a Core Data document-based app, is... Simply drop the following override into the NSPersistentDocument subclass: - (id)initWithContentsOfURL:(NSURL*)url ofType:(NSString*)typeName error:(NSError**)error_p { // NSPersistentDocument's built-in Persistence Stack seems to create a store // without setting the NSMigratePersistentStoresAutomaticallyOption, so // automatic migration just doesn't work. The following code, which runs // only for existing documents, works around that problem. NSError* error = nil ; NSArray* bundles = [NSArray arrayWithObject:[NSBundle mainBundle]] ; NSManagedObjectModel* mergedMOM = [NSManagedObjectModel mergedModelFromBundles:bundles] ; NSPersistentStoreCoordinator *psc = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:mergedMOM]; NSDictionary *optionsDictionary = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:NSMigratePersistentStoresAutomaticallyOption]; id store = [psc addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:url options:optionsDictionary error:error] ; // If migrating the document from and older to the current model was necessary, // it is now all done! The addPersistentStoreWithType: will have renamed the // old file with a tilde on the end and created a new, migrated file at the given // URL. So now, when we invoke super, it will open the new file and just work. // Very nice. if (store) { self = [super initWithContentsOfURL:url ofType:typeName error:error] ; // The above method will return nil if it fails. } else { [self release] ; self = nil ; } if (!self error_p) { *error_p = error ; } return self; } ___ 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: Where are the interface builder components?
OK, so you want one of these controls yourself? Well, let's imagine you're going to sit down and write one for your app. Are you honestly telling me that you expect to end up with highly reusable code that could be placed in a framework like Cocoa, and you'd be happy to ship to a large number of other developers? Or (and far more likely) that you'll have implemented only the bits of functionality your own app needs and left plenty of holes to fill? Please i'm not trying to offend anyone here, i was just questioning... but since you ask. I try my best to design my classes with the re-usability in mind, also to the best of my knowledge of the language at the time of design, mostly because I do not like to have to rewrite things, it's a waste of time, efforts and money... occasionally I will rewrite a class to improve it with new acquired knowledge and techniques yes, for instance when i learned that i could iterate thru a collection using a for loop instead of while loop coupled with an iterator, i did change most of my classes to reflect that ease of use. same thing for when I learned of properties and KVM coding. Additionally I always write my code with someone might need to use this kind of approach, it takes me a little more time but it's worth it in the end. If I was to provide quality development tools to my users, I would make sure my employees have that mindset when hacking together a class, yes, because the time spent un-mixing the mess afterwards to release proper components is just to costly. 1: it takes them away from the creative bench to think of new features 2: it doubles the initial effort therefor doubling the cost, in human hours. Unfortunately for me right now i do not believe I have proper and all the handles on cocoa to create my own controls, but i'm getting there My first controls will probably have holes and missing features, and might respond to specific needs, but then again i'm one guy with less than a year of experience with cocoa. Tho I try my best to measure up, I'm not Apple. This thread of emails want not intended to bash Apple for not doing their work, I just needed to understand why the components are not already available in the toolbox when it seemed logical to me that they should of been there with the release of the operating system along with all the new features so application developers could take full advantage of it. Thank you all for your feedback and explanations! As usual this community Rocks! Cheers. Sandro Noel. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
tableView:setObjectValue:forTableColumn:row: not called when button pressed
Table with editable columns, user is editing a cell, user is done, user clicks Save button. User's last change is lost because tableView:setObjectValue:forTableColumn:row: is not called. It is only called if the cell loses focus via the user tabbing out of the cell or clicking in some other editable cell. This behavior is 10.5 10.6--10.4 10.3 worked as I expected them to, first user edit is processed, then button's action method. What's the workaround to get the user's last data entry when the Save button is clicked? -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Where are the interface builder components?
On 11/19/2009 5:45 PM, Sandro Noël sandro.n...@gestosoft.com wrote: This thread of emails want not intended to bash Apple for not doing their work, I just needed to understand why the components are not already available in the toolbox when it seemed logical to me that they should of been there with the release of the operating system along with all the new features so application developers could take full advantage of it. Apple's applications, frameworks, and operating system are typically developed by different people, and although some cutting edge stuff may be shared amongst all (typically when they can be assured such resources are going to be available amongst all those realms), some things just cannot due to a variety of reasons, so it's entirely possible that every application that uses HUD controls may have very disparate implementations. ___ 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: tiffs on pasteboard
But what are the rules and conventions? Why would Finder put the icon in the pasteboard on the assumption that is what the user wants, but TextEdit would paste in the actual file on the assumption that is what the user wants? It seems schizophrenic. I just want a list of rules of how to use the Pasteboard in a way that conforms to what users expect. If I start ignoring the TIFF part of the pasteboard in favor of the URL on the assumption that is what the user wants, why is the tiff there anyway? And will that get me into trouble in other cases? From: Jens Alfke j...@mooseyard.com To: Chris Idou idou...@yahoo.com Cc: Kyle Sluder kyle.slu...@gmail.com; cocoa-dev@lists.apple.com Sent: Fri, 20 November, 2009 12:29:51 PM Subject: Re: tiffs on pasteboard On Nov 19, 2009, at 5:24 PM, Chris Idou wrote: But I'm still confused about one thing: If copying from Finder actually copies the file icon, and not the actual tiff, how come it pastes ok into TextEdit? The Finder also puts the location of the file on the pasteboard, and I believe TextEdit sees that, recognizes that it's an image file, and reads the file into an image. You can do the same fairly easily. —Jens __ Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7. Enter now: http://au.docs.yahoo.com/homepageset/ ___ 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 to avoid text distortion
Hi, I have created an Application using Wizard like design with the help of NSView. But all the text displayed in each page, even all labels also gets distorted. Like the all the font edges are not sharp and font edges are seen to be dsitorted. regards, Pappan ___ 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 to avoid text distortion
Please post a screen shot of what you're talking about; perhaps you're just seeing anti-aliased text? ___ 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: tableView:setObjectValue:forTableColumn:row: not called when button pressed
Scott Ribe (scott_r...@killerbytes.com) on 2009-11-19 8:53 PM said: Table with editable columns, user is editing a cell, user is done, user clicks Save button. User's last change is lost because tableView:setObjectValue:forTableColumn:row: is not called. It is only called if the cell loses focus via the user tabbing out of the cell or clicking in some other editable cell. This behavior is 10.5 10.6--10.4 10.3 worked as I expected them to, first user edit is processed, then button's action method. If I understand you correctly, this is described in the 10.5 AppKit Release Notes: http://developer.apple.com/mac/library/releasenotes/cocoa/ AppKitOlderNotes.html#X10_5Notes under the heading Changes in NSDocument's Handling of Editors Registered via Cocoa Bindings' NSEditorRegistration Informal Protocol What's the workaround to get the user's last data entry when the Save button is clicked? I guess you mean other than manually telling all NSControllers of all windows to commitEditing? :) I've been meaning to figure out a nice generic solution to this problem as well, but never did. Sean ___ 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
Dealing with faults in CoreData / AppleScript
I've been working through adding scriptability to my CoreData application but ran into a snag: accessing relationships may return a fault instead of the actual set of objects. Is there an accepted way of solving this issue? I don't want the accessor to always fault the objects in, just when they're being accessed from AppleScript. Is creating another accessor the proper way to get around this? Thanks, Greg ___ 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
resizing PDF obtained from dataWithPDFInsideRect:
I've got an image that's generated using a large integer coordinate space. When it's drawn to the screen, its coordinates are converted to screen coordinates. Unfortunately, the screen coordinates are assumed to be integers and it's not a simple fix to use floats (the code is common to Mac, Windows, and X Windows). The code will be eventually rewritten, just not anytime soon. The conversion to screen coordinates is causing stair stepping in connected lines and other oddities when exporting to PDF. As a temporary solution until the code is rewritten, I've created a subclass of my view that's sized at the large coordinate space's dimensions specifically for rendering the image to PDF. However, I can't seem to resize the PDF data down to the more manageable screen view's dimensions when saving to disk. I've tried creating an NSPDFImageRep from the PDF data and resizing it but it has no effect on the saved to disk image (I guess setSize: does not affect the original data). What I end up with is a PDF file with large dimensions that overwhelms whatever application I'm placing it into. What I ended up doing is creating an NSView subclass that simply draws the PDF at the size I want and returns the PDF data from that. This works but is there a better way of resizing the dimensions of PDF data or is the size the size that it's generated at and there's no changing it? Also, I allow the user to export the image as a bitmap and even override the dimensions. I create an NSImage from the PDF data, resize the NSImage, then save the TIFF representation to the bitmap format I want. This works in Leopard but no longer works in Snow Leopard. I read the tech note about changes to NSImage and caching but I had no luck with the different caching methods. I ended up creating an NSImage at the desired size, locking the focus, drawing the PDF data at the desired size, unlocking the focus, then saving the TIFF representation. Is there a better way? And finally, is there a way to change the resolution of a bitmap from 72dpi to say 300dpi? My users want to be able to specify the dimensions of the exported bitmap in inches and the resolution. They want to be able to place their 1800 pixel wide TIFF file into Word and it show up 6 inches wide (@ 300dpi) instead of 25 inches wide (@ 72dpi). Not a huge deal because I still recommend our users use PDF but some of them have legacy apps that don't support PDF. The example I was able to find on this created a new NSBitmapImageRep and copied the image data into it and then set the size. TIA. -Chinh Nguyen cngu...@stata.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
Stretching NSImage PNGs smoothly
I know about how to use UIKit's -(UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight to stretch a PNG smoothly, e.g when inserting text in an iChat like bubble. I would like to do the same on regular AppKit/Cocoa/desktop app using CoreGraphics or some NSImage related API but couldn't find an equivalent method. Does anybody know how to do this in AppKit? Ref: http://stackoverflow.com/questions/663435/implement-view-like-standard-iphone-sms-chat-bubbles-view Thanks, John Wright ___ 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: Stretching NSImage PNGs smoothly
NSDrawThreePartImage() might help. Of course, it requires three separate images to begin with. (I find this preferable, though, because it avoids having to hard-code image sizes in your code.) In my testing several months ago, though, I found that manually drawing the three segments (using NSImage's -drawInRect:) to be faster. So if performance is an issue, you might be better off rolling your own. ___ 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
initializer methods
After many years of using procedural programming languages, I am trying to learn Cocoa. Today I am reading the Apple document The Objective-C Programming Language dated 2009-10-19. On page 46 I read the following: This is an example of what not to do: + (Rectangle *)rectangleOfColor:(NSColor *) color { self = [[Rectangle alloc] init]; // BAD [self setColor:color]; return [self autorelease]; } However, on page 49 I read the following: There are several constraints and conventions that apply to initializer methods that do not apply to other methods: . . . • You should assign self to the value returned by the initializer. This is because the initializer could return a different object than the original receiver. Could someone please explain this apparent contradiction? Lynn___ 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: Stretching NSImage PNGs smoothly
On Thu, Nov 19, 2009 at 8:05 PM, Dave Keck davek...@gmail.com wrote: In my testing several months ago, though, I found that manually drawing the three segments (using NSImage's -drawInRect:) to be faster. So if performance is an issue, you might be better off rolling your own. Did you account for resolution independence and integral pixel alignment? If not, I can see how your own code would be faster. Otherwise, I imagine Apple has done a great deal of optimization on these functions. If not, it might be worth filing a bug. --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: initializer methods
Lynn Barton wrote: After many years of using procedural programming languages, I am trying to learn Cocoa. Today I am reading the Apple document The Objective-C Programming Language dated 2009-10-19. On page 46 I read the following: This is an example of what not to do: + (Rectangle *)rectangleOfColor:(NSColor *) color { self = [[Rectangle alloc] init]; // BAD [self setColor:color]; return [self autorelease]; } However, on page 49 I read the following: There are several constraints and conventions that apply to initializer methods that do not apply to other methods: . . . • You should assign self to the value returned by the initializer. This is because the initializer could return a different object than the original receiver. Could someone please explain this apparent contradiction? Because the first method isn't an initializer method, it's a Class method, a convenience method for returning another object. initializers are the instance methods which conventionally start with init (look a bit back from where you were on page 49) and those methods should assign to self because self in that case means the object you are initializing (and returning). For class methods, self is the class, in that example at the top you're not returning the class or a class object, you want to return an object OF the class, so self is just the wrong thing to use. Remember that a '+' at the start of a method signature denotes a class method, a '-' at the start of a method signature denotes an instance method. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: initializer methods
Lynn Barton (lynnbar...@mac.com) on 2009-11-19 11:15 PM said: This is an example of what not to do: + (Rectangle *)rectangleOfColor:(NSColor *) color { self = [[Rectangle alloc] init]; // BAD [self setColor:color]; return [self autorelease]; } However, on page 49 I read the following: There are several constraints and conventions that apply to initializer methods that do not apply to other methods: . . . • You should assign self to the value returned by the initializer. This is because the initializer could return a different object than the original receiver. Could someone please explain this apparent contradiction? There's no contradiction because +rectangleOfColor: is not an initializer method. Initializers 1) start with init and 2) are instance methods, not class methods (start with a - not a +). Page 49 is talking about implementing custom initializers, rectangleOfColour is not one. Good luck! Sean -- Freedom is never voluntarily given by the oppressor; it must be demanded by the oppressed. - Martin Luther King___ 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 to avoid text distortion
Hi Dave, I think my case is some thing related with anti-aliased text. Because as per your suggestion I made a screen shot and saved In my Mac Book. I have transfered the saved png image to my Windows PC to post in llist. But interestingly the screen shot when viewed in Windows don't have that problem. So I think no use in posting that image. Text are crystal clear. but the same screen shot when viewed in my Mac book again showed the same problem. One more point is that I am using Xcode 3.2 in Snow Leopard (Version 10.6.2) and in System Preference - Appearence - Use LCD font smoothing when available option is disabled , again font and text are displayed perfectly ie with out any distortion. If I enable this option which is enabled by default this problem occurs. But this problem happens only with the application I have developed. Regards, Pappan Dave Keck wrote: Please post a screen shot of what you're talking about; perhaps you're just seeing anti-aliased text? ___ 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: Trouble finding bounding rect of NSAttributedString
Your question has caused me to dig deeper... It seems that when I handle both the NSViewFrameDidChangeNotification and the NSTableViewSelectionDidChangeNotification notifications, the attributedString of the textView's layout manager is nil. This is very interesting... Here's a bit more of my setup. I have an NSTableView, populated by an NSArrayController. The textView's data is bound to the arrayController's selection.data (which provides an RTF NSData object). That works as expected. I observe the ViewFrameDidChangeNotification on the textView, so that as the user types in text and the textview grows, I can also resize the superview accordingly. I was listening to the selectionDidChange notification of the NSTableView, because (I've observed) when the data to be shown in the textview is smaller than the current size of the textview, it does not resize down to fit the content. This is the behavior that I'm looking for. However, in both of these methods, the attributedString of the textview is nil, thus giving me the strange results I'm seeing. What would be the appropriate way to get the behavior I'm looking for? Thanks, Dave On Nov 19, 2009, at 4:28 PM, Jens Alfke wrote: On Nov 19, 2009, at 2:39 PM, Dave DeLong wrote: When I print out the size or rect that these return, I invariably get either {0, 0} or something absurd like {{1.17076e-318, 2.29357e-314}, {2.30359e-314, 2.1224e-314}} (that's just running the rect through NSStringFromRect()) Make sure the receiver (the NSAttributedString) isn't nil. The Obj-C runtime gives undefined results for a struct-based method return value if the receiver is nil; so you'll end up with garbage like this. (This is because it doesn't know at runtime how large the struct is, so it can't safely fill it in with zeroes.) Put in something like NSAssert(str!=nil, @str is nil); before the call. —Jens smime.p7s Description: S/MIME cryptographic signature ___ 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 to avoid the movie distortion ?
Hi, all I implement a simple movie player using QTMovieView. But some movies will be distorted by reason of the proportion of the Height and Width. How to avoid the movie distortion? Thanks. James___ 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 to avoid text distortion
On 20/11/2009, at 3:23 PM, padmakumar wrote: One more point is that I am using Xcode 3.2 in Snow Leopard (Version 10.6.2) and in System Preference - Appearence - Use LCD font smoothing when available option is disabled , again font and text are displayed perfectly ie with out any distortion. If I enable this option which is enabled by default this problem occurs. But this problem happens only with the application I have developed. I suspect you are using a layer-backed view. NSTextFields with no background color will display without sub-pixel anti-aliasing on layer-backed views. If you want the text to have sub-pixel anti-aliasing, give the text field a background color. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
asl_log aborts the program?
I've got a report from a user of my program crashing. In the console they are getting this: 11/19/09 3:08:46 PM[0x0-0x18a18a]Progname[8699]Progname(8699,0x1167b) malloc: *** error for object 0x100563870: pointer being freed was not allocated 11/19/09 3:08:46 PM[0x0-0x18a18a] Progname[8699]*** set a breakpoint in malloc_error_break to debug And in the crash report: Process: Progname [11128] Path:/Applications/Progname.app/Contents/MacOS/Progname Identifier: Progname Version: 1.19 (19) Code Type: X86-64 (Native) Parent Process: launchd [180] Date/Time: 2009-11-19 17:40:42.570 -0500 OS Version: Mac OS X 10.6.2 (10C540) Report Version: 6 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x, 0x Crashed Thread: 2 Application Specific Information: abort() called objc[11128]: garbage collection is ON Thread 0: Dispatch queue: com.apple.main-thread 0 libSystem.B.dylib 0x7fff879a7e3a mach_msg_trap + 10 1 libSystem.B.dylib 0x7fff879a84ad mach_msg + 59 2 com.apple.CoreFoundation 0x7fff86c997a2 __CFRunLoopRun + 1698 3 com.apple.CoreFoundation 0x7fff86c98c2f CFRunLoopRunSpecific + 575 4 com.apple.HIToolbox 0x7fff865b9a4e RunCurrentEventLoopInMode + 333 5 com.apple.HIToolbox 0x7fff865b9853 ReceiveNextEventCommon + 310 6 com.apple.HIToolbox 0x7fff865b970c BlockUntilNextEventMatchingListInMode + 59 7 com.apple.AppKit 0x7fff815f31f2 _DPSNextEvent + 708 8 com.apple.AppKit 0x7fff815f2b41 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 155 9 com.apple.AppKit 0x7fff815b8747 -[NSApplication run] + 395 10 Progname 0x00010eea main + 76 11 Progname 0x00010e7c start + 52 Thread 1: Dispatch queue: com.apple.libdispatch-manager 0 libSystem.B.dylib 0x7fff879c0bba kevent + 10 1 libSystem.B.dylib 0x7fff879c2a85 _dispatch_mgr_invoke + 154 2 libSystem.B.dylib 0x7fff879c275c _dispatch_queue_invoke + 185 3 libSystem.B.dylib 0x7fff879c2286 _dispatch_worker_thread2 + 244 4 libSystem.B.dylib 0x7fff879c1bb8 _pthread_wqthread + 353 5 libSystem.B.dylib 0x7fff879c1a55 start_wqthread + 13 Thread 2 Crashed: 0 libSystem.B.dylib 0x7fff87a7784d usleep$NOCANCEL + 0 1 libSystem.B.dylib 0x7fff87a96e3c abort + 93 2 libSystem.B.dylib 0x7fff879ae155 free + 128 3 libSystem.B.dylib 0x7fff879fa16e asl_set_query + 572 4 libSystem.B.dylib 0x7fff87a16239 asl_send + 824 5 libSystem.B.dylib 0x7fff87a15e56 asl_vlog + 570 6 libSystem.B.dylib 0x7fff87a15c19 asl_log + 153 7 Progname.CocoaTools0x000104567101 -[Log vlogLevel:format:arguments:] + 270 8 Progname.CocoaTools0x00010456730c -[Log notice:] + 164 etc Does this look like an Apple bug? It looks to me like the asl subsystem is freeing something it shouldn't and aborting the program. __ Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7. Enter now: http://au.docs.yahoo.com/homepageset/ ___ 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