Hello,

Your class model does not need to be a NSObject subclass. All you need
it to return an Id subclass when asked by the view.
Thanks to explicit casting on some types, it can be done in a simple way:
- A String value can be returned casted as NSString
- An int or long value can be returned casted a NSNumber
- for the other values, it depends on what you want to display. For
the images, I often used named images (NSImage.ImageNamed).

Take a look at the NSNumber and NSString wrapper to see how you can
take advantage of the explicit casting.

Regards, Laurent Etiemble.

2009/1/16 Mario De Clippeleir <mari...@sydec.be>:
> Hi,
>
> I understand this, but my main concern is : how do i return an item of type
> Id from my own class model ? Should the class inherit from NSObject ?
> Because this is not what i want...
>
> Br,
>
> Mario
> On 14 Jan 2009, at 09:45, Laurent Etiemble wrote:
>
>> Hello,
>>
>> NSOutlineView is almost the same as NSTableView. Wire the
>> NSOutlineView to an instance that acts as a datasource and a delegate,
>> and then responds to message to populate the NSOutlineView.
>>
>> See:
>>
>> http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSOutlineView_Class/Reference/Reference.html
>>
>> http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSOutlineViewDataSource_Protocol/Reference/Reference.html#//apple_ref/occ/cat/NSOutlineViewDataSource
>>
>> As noted in the documentation, the view does not store any data, so
>> the view asks for data as needed. Your model should typically include
>> some sort of unique key that is used to identify the data row (you can
>> use a static int counter). When the NSOutlineView needs to display
>> something, it will ask for the data by passing the column identifier
>> and the unique key.
>>
>> You can also take a look at the Cocoa samples in the SDK. There is a
>> sample about NSOutlineView.
>>
>> Regards, Laurent Etiemble.
>>
>> 2009/1/12 Mario De Clippeleir <mari...@sydec.be>:
>>>
>>> Hi,
>>>
>>>
>>>
>>> Does anybody have experience with NSOutlineView ? Any examples out there
>>> ?
>>>
>>>
>>>
>>> Br,
>>>
>>>
>>>
>>> Mario
>
>

Reply via email to