[Drawkit] [self selectedAvailableObjects] empty!??

James Maxwell jbmaxwell at rubato-music.com
Thu Jul 17 20:39:49 PDT 2008


Hi Graham,

No, it wound up being a problem with my AppController. I had an  
instance in IB, and an instance in xCode, and the two were passing  
like ships in the night. I still rigourously try to avoid IB, but I  
guess I have to get over that soon. I just find it extremely  
confusing... Anyway, that's off-topic.

My subclass of DKObjectDrawingLayer does a few things, some concerning  
selections, others concerning my "musical grid". I couldn't see any  
direct way of doing what I needed to do, other than subclassing, and  
it seems to be okay, for the moment... To be honest, I don't really  
know anything about categories. I'm thinking they're a bit like  
Interfaces in Java, but I don't really know. I do want to find a more  
recent xCode book, and I'd love a book on Objective-C 2.0, but there's  
nothing out yet. I know Apple has a fairly large document on it. I'll  
look into that further, but it's pretty painful reading, imho... (and  
reading it online just adds insult to injury.)

I appreciate your concern, though. I am still really just prototyping,  
at this point; trying to get my feet set in Cocoa and also to figure  
out the best ways of doing the things I need to do. I've actually come  
a long way, really. Particularly in the sense that now I definitely  
know I can do what I need to do (which I wasn't at all sure about a  
few months ago). When it comes time to start coding the real deal,  
I'll look over my notes, your suggestions, and the feedback I've had  
from others, and compile a more comprehensive design, which uses as  
much of the code I've already written as possible, but also starts  
many things fresh. I'm really a hands-on learner - trial and error.  
Reading computer books is truly painful for me! Duller than dish  
water. I always start out with them very excited and ready to go, but  
a few days into it and it's like yanking my own teeth out with rusty  
pliers. I'm sure you understand. ;-)

cheers,

J.


On 17-Jul-08, at 8:01 PM, Graham Cox wrote:

> James, I'm not sure that makes much sense really.
>
> If you subclassed DKObjectDrawingLayer then it should be consistent  
> with respect to its inherited methods regardless of how you have  
> implemented your document controller elsewhere, which on the face of  
> it would appear to have no relation to the layer code.
>
> Something smells, in other words.
>
> Also, I wouldn't undertake subclassing that particular kind of layer  
> without a very good reason. You might have one of course... but in  
> most cases extending functionality using categories is the better  
> option.
>
>
> cheers, Graham
>
>
>
> On 18 Jul 2008, at 7:29 am, James Maxwell wrote:
>
>> The Cocoa-dev folks helped me out... I was using a vanilla NSObject  
>> for my controller.
>> Switching that to an NSDocumentController subclass made life much  
>> easier!
>>
>> J.
>>
>> On 17-Jul-08, at 11:10 AM, James Maxwell wrote:
>>
>>> Hi All,
>>>
>>> I'm using a basic AppController type class to add some custom key  
>>> commands from IB to my drawkit-based app.
>>> I have a first command working, and it's calling a method from my  
>>> DKObjectDrawingLayer subclass. But when I try to iterate over the  
>>> selected objects using "[self selectedAvailableObjects];", the  
>>> selection is empty. What's making me crazy is that the moveUp: and  
>>> moveDown: methods work fine, suggesting that - 
>>> selectedAvailableObjects: is obviously returning what it should be  
>>> returning (since moveUp/Down rely on -selectedAvailableObjects:).
>>>
>>> Also, overriding -addObjectToSelection: in my DKObjectDrawingLayer  
>>> subclass, and putting an NSLog in:
>>>
>>> NSLog(@"Selected objects? %i", [self  
>>> countOfSelectedAvailableObjects]);
>>>
>>> reveals the expected count... Meaning, I assume, that the  
>>> selection definitely is NOT empty...
>>>
>>> I'm stumped.
>>>
> _______________________________________________
> Drawkit mailing list
> Drawkit at lists.apptree.net
> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net



More information about the Drawkit mailing list