[Drawkit] [self selectedAvailableObjects] empty!??

Graham Cox graham.cox at bigpond.com
Thu Jul 17 20:01:16 PDT 2008


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.
>>


More information about the Drawkit mailing list