FROM : Jonathan Dann
DATE : Wed Mar 26 20:59:12 2008
On 26 Mar 2008, at 00:45, Hamish Allan wrote:
> Hi Jon,
>
> On Tue, Mar 25, 2008 at 9:49 PM, Jonathan Dann <j.p.<email_removed>>
> wrote:
>
>> As of 10.5 it's the Apple-sanctioned way to go! I've used it for
>> ages
>> now, no problems at all. The tree node is a proxy for whatever
>> 'real'
>> item you add to the tree.
>
> I just wondered why it was NSTreeControllerTreeNode rather than
> NSTreeNode. I'm just naturally wary of solutions beginning "class-dump
> shows..."!
You do get a lot of that, it's maybe a contrived example, but many of
your classes will get replaced at runtime by isa-swizzling to make
them something like KVONotifyingMyAwesomeClass (I forget the prefix
Apple adds, just have a look in the debugger). It'll just be some odd
implementation detail that will be beyond me! The 10.5 docs for
NSTreeController all refer to NSTreeNode.
>
>
>> You can also get the selectedNodes, which returns treeNode objects,
>> or
>> the selectedObjects, which returns the 'real' obejcts that you've
>> created.
>
> Splendid!
>
>> My isGroupItem just compares an NSString *nodeName of the represented
>> object to a list of strings I want to have as groups, i.e @"SOURCES",
>> @"PLAYLISTS", etc.
>
> I just treat everything at the top level as a group item:
>
> - (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item
> {
> return ([outlineView parentForItem:item] == nil);
> }
>
>
> Thank you for your autosaving advice; I did see your code for that on
> the list recently, and it will doubtless be very useful.
>
You're welcome.
Jon
DATE : Wed Mar 26 20:59:12 2008
On 26 Mar 2008, at 00:45, Hamish Allan wrote:
> Hi Jon,
>
> On Tue, Mar 25, 2008 at 9:49 PM, Jonathan Dann <j.p.<email_removed>>
> wrote:
>
>> As of 10.5 it's the Apple-sanctioned way to go! I've used it for
>> ages
>> now, no problems at all. The tree node is a proxy for whatever
>> 'real'
>> item you add to the tree.
>
> I just wondered why it was NSTreeControllerTreeNode rather than
> NSTreeNode. I'm just naturally wary of solutions beginning "class-dump
> shows..."!
You do get a lot of that, it's maybe a contrived example, but many of
your classes will get replaced at runtime by isa-swizzling to make
them something like KVONotifyingMyAwesomeClass (I forget the prefix
Apple adds, just have a look in the debugger). It'll just be some odd
implementation detail that will be beyond me! The 10.5 docs for
NSTreeController all refer to NSTreeNode.
>
>
>> You can also get the selectedNodes, which returns treeNode objects,
>> or
>> the selectedObjects, which returns the 'real' obejcts that you've
>> created.
>
> Splendid!
>
>> My isGroupItem just compares an NSString *nodeName of the represented
>> object to a list of strings I want to have as groups, i.e @"SOURCES",
>> @"PLAYLISTS", etc.
>
> I just treat everything at the top level as a group item:
>
> - (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item
> {
> return ([outlineView parentForItem:item] == nil);
> }
>
>
> Thank you for your autosaving advice; I did see your code for that on
> the list recently, and it will doubtless be very useful.
>
You're welcome.
Jon
| Related mails | Author | Date |
|---|---|---|
| Hamish Allan | Mar 25, 02:42 | |
| Rob Keniger | Mar 25, 07:20 | |
| Hamish Allan | Mar 25, 22:07 | |
| Jonathan Dann | Mar 25, 22:49 | |
| Hamish Allan | Mar 26, 01:45 | |
| Jonathan Dann | Mar 26, 20:59 |






Cocoa mail archive

