Performing the selector from a stored IMP

2011-02-11 Thread Joanna Carter
Hi folks I want to store a method pointer in a dictionary, recover it and call it from elsewhere in code. So, I have code like this to store the method pointer: { IMP anIMP = [anObject methodForSelector:@selector( myMethod: )]; [myDictionary setObject:anIMP forKey:myKey]; } … and then,

Re: Performing the selector from a stored IMP

2011-02-11 Thread Jerry Krinock
On 2011 Feb 11, at 04:21, Joanna Carter wrote: IMP anIMP = [anObject methodForSelector:@selector( myMethod: )]; [myDictionary setObject:anIMP forKey:myKey]; The compiler should warn you on that second line that an IMP is not an object. This code won't work. Or have I misunderstood what

Re: Performing the selector from a stored IMP

2011-02-11 Thread Jean-Daniel Dupas
Le 11 févr. 2011 à 13:21, Joanna Carter a écrit : Hi folks I want to store a method pointer in a dictionary, recover it and call it from elsewhere in code. So, I have code like this to store the method pointer: { IMP anIMP = [anObject methodForSelector:@selector( myMethod: )];

Re: Performing the selector from a stored IMP

2011-02-11 Thread Joanna Carter
Hi Jerry You've misunderstood what an IMP *is*. Heheheh, I thought as much :-) If you want to store a method, you could probably wrap that the pointer value of an IMP as an NSValue. Read NSValue. Or, for persistent storage, store the method name you get from NSStringFromSelector(), then

Re: Performing the selector from a stored IMP

2011-02-11 Thread Jean-Daniel Dupas
Le 11 févr. 2011 à 14:31, Joanna Carter a écrit : Hi Jerry You've misunderstood what an IMP *is*. Heheheh, I thought as much :-) If you want to store a method, you could probably wrap that the pointer value of an IMP as an NSValue. Read NSValue. Or, for persistent storage, store

NSTreeNode mutableChildNodes documented as observable using key-value observing

2011-02-11 Thread jonat...@mugginsoft.com
The docs for NSTreeNode -mutableChildNodes states: The array that is returned is observable using key-value observing. This doesn't seem to make any sense nor does it seem to be true. What does seem to be true is that NSTreeNode - childNodes is observable using key-value observing. When

Re: Strange problem drawing a custom grid in NSTableView

2011-02-11 Thread Eric Gorr
I filed a bug report on this: rdar://8988596 Hopefully this will be fixed soon or a workaround provided. In the meantime, I will just disable the Automatically Hide Scrollers feature of NSScrollView. On Feb 10, 2011, at 7:07 PM, Eric Gorr wrote: Unfortunately, no. -

Re: Need help sorting with NSSortDescriptor and/or/NSPredicate (Core Data)

2011-02-11 Thread Michael Crawford
Thank you both for your suggestions. I ended up going with Ken's idea regarding the synthetic property. It was added to a NSManagedObject derived class so I couldn't use it during the fetch request without actually adding an attribute but I did use it to sort the resulting array. The

Re: Need help sorting with NSSortDescriptor and/or/NSPredicate (Core Data)

2011-02-11 Thread Ken Thomases
On Feb 11, 2011, at 9:19 AM, Michael Crawford wrote: Thank you both for your suggestions. You're welcome. I'm glad I could help. I ended up going with Ken's idea regarding the synthetic property. It was added to a NSManagedObject derived class so I couldn't use it during the fetch

Carbon overlay window in place of a cocoa view

2011-02-11 Thread Kevin Meaney
Hi, I've taken the Audio Unit (AU) code for carbon overlay windows over a cocoa view and modified it for my purposes as a proof of concept test. I needed to make some changes to improve the AU code in my case (the left edge of the cocoa view can move because it is on the right side of a

Re: Get ProcessSerialNumber of last front application

2011-02-11 Thread Mr. Gecko
Would using carbon events be against the rules of the Mac App Store? I thought carbon was deprecated. I think it may just be the interface stuff in carbon, but not sure. On Feb 9, 2011, at 1:21 PM, Jean-Daniel Dupas wrote: Carbon events are events. As long as you don't receive one, your app

Re: Get ProcessSerialNumber of last front application

2011-02-11 Thread Jean-Daniel Dupas
Does your application compile on 64 bits ? Do you get a deprecation warning when using required functions ? When the answer is no for both questions, I personally consider that the function is not deprecated. If you have a specific question about Store validation, ask Apple directly. Nobody

Re: Get ProcessSerialNumber of last front application

2011-02-11 Thread Mr. Gecko
Thanks, I'm working out the code now and if it will compile on 64bit, then I'll use it. On Feb 11, 2011, at 10:15 AM, Jean-Daniel Dupas wrote: Does your application compile on 64 bits ? Do you get a deprecation warning when using required functions ? When the answer is no for both

Re: Performing the selector from a stored IMP

2011-02-11 Thread Matt Neuburg
Date: Fri, 11 Feb 2011 12:21:29 + From: Joanna Carter cocoa...@carterconsulting.org.uk Subject: Performing the selector from a stored IMP I want to store a method pointer in a dictionary, recover it and call it from elsewhere in code. Consider NSInvocation... m. -- matt neuburg,

Re: [ANN] Cong 0.7

2011-02-11 Thread Carter Allen
Really excellent work on this! Nice job catching the fact that I was using an embedded framework and kept the headers in there...though I'm not sure how to automate the removal of them during the build (hmm). It would be great if this was part of Xcode in some way (obviously a tough request).

Re: [ANN] Cong 0.7

2011-02-11 Thread Kyle Sluder
On Feb 11, 2011, at 9:57 AM, Carter Allen li...@cartera.me wrote: Really excellent work on this! Nice job catching the fact that I was using an embedded framework and kept the headers in there...though I'm not sure how to automate the removal of them during the build (hmm). It would be great

NSUnicodeStringEncoding

2011-02-11 Thread Todd Heberlein
Looking at the NSString class there is the method initWithBytes:length:encoding: I have a unicode string (in C++ object) that I can extract in a number of different byte stream formats (UTF-8, UTF-16 (w or w/o BOM)) that I need to encode into an NSString. Does the

Re: NSUnicodeStringEncoding

2011-02-11 Thread Kyle Sluder
On Fri, Feb 11, 2011 at 10:57 AM, Todd Heberlein todd_heberl...@mac.com wrote: Looking at the NSString class there is the method        initWithBytes:length:encoding: I have a unicode string (in C++ object) that I can extract in a number of different byte stream formats (UTF-8, UTF-16 (w or

Re: Performing the selector from a stored IMP

2011-02-11 Thread Joanna Carter
Hi Matt Consider NSInvocation... m. Hmmm, nice! My only objection to using it in the circumstances I have is that it is a lot more code to setup than the idea of a protocol with three methods, implemented by the target class. However, I am indebted to you for pointing out this class and

Re: Performing the selector from a stored IMP

2011-02-11 Thread Tito Ciuro
Hello, Being curious about the performance implications of using NSInvocation vs Objective-C message send vs IMP-cached message send, I was surprised to see how much slower NSInvocation seems to be compared to the other two mechanisms (the following data was last collected on Leopard, so these

Re: Performing the selector from a stored IMP

2011-02-11 Thread Matt Neuburg
On Feb 11, 2011, at 12:20 PM, Joanna Carter wrote: Consider NSInvocation... m. Hmmm, nice! My only objection to using it in the circumstances I have is that it is a lot more code to setup But consider NSUndoManager. What its +prepareWithInvocationTarget:+ does is almost exactly what

Re: Performing the selector from a stored IMP

2011-02-11 Thread Joanna Carter
Hi Matt But consider NSUndoManager. What its +prepareWithInvocationTarget:+ does is almost exactly what you describe: you give it a target and send it a method call, a method call that NSUndoManager itself cannot respond to. Instead of complaining, it freeze-dries that method call and its

Re: [ANN] Cong 0.7

2011-02-11 Thread David Rowland
I have two apps in the store now. I run Cong and drag the release version of either one from the Build folder onto Cong. It gives me one report -- ./Contents folder not found. Earlier versions of these have been accepted and put on the store. What is it telling me? Am I using it wrong?

Re: Performing the selector from a stored IMP

2011-02-11 Thread Bill Bumgarner
On Feb 11, 2011, at 1:16 PM, Joanna Carter wrote: I would totally agree that it is a phenomenally powerful concept, giving just the kind of functionality I was originally looking for, as a replacement for method pointers. I will be using it as soon as I find a need that warrants it. But,

specifying new document types that an app opens

2011-02-11 Thread davelist
I'm working on a document-based app for the Mac App Store. The data file I'm reading/writing is actual a Sqlite database file. I've been able to get it to work with the following in my info.plist file (although for this email I've used appname in place of the actual appname and file extension

NSTableView auto sorting does not work

2011-02-11 Thread Chris Tracewell
I have experienced that an NSTableview which is bound to an array controller will sometimes automatically sort when their column headers are clicked and sometimes not. As an example, I currently have two windows, each with a tableview bound to an array controller. One tableview sorts, the other

Re: NSTableView auto sorting does not work

2011-02-11 Thread Kyle Sluder
On Fri, Feb 11, 2011 at 5:14 PM, Chris Tracewell ch...@thinkcl.com wrote: I have experienced that an NSTableview which is bound to an array controller will sometimes automatically sort when their column headers are clicked and sometimes not. As an example, I currently have two windows, each

Looking for suggestions/help on a multi-file data model

2011-02-11 Thread Andy Akins
I'm working on an application that has multiple files as part of its data model, and I'm not sure on the approach I should take. An example of what I mean: Imagine a purchasing application. First, you have to open a catalog - a file that lists the items that are available. There might be