Re: NSOutlineView newbie completely flummoxed
Re: NSOutlineView newbie completely flummoxed
- Subject: Re: NSOutlineView newbie completely flummoxed
- From: John Anderson <email@hidden>
- Date: Thu, 20 Jun 2002 13:22:59 -0700
The UI always drives the data source, but you can tell the UI how to
drive the data source. Basically every item in an outline is tied to an
"item" object in the data source. You must retain this item yourself;
the outline view doesn't do this for you.
What I typically do is express items as paths, and use a caching
routine to make sure everything gets retained properly. Perhaps keep
your path strings in an NSArray and refer to them later. To change the
data that displays in the outline view, just change the information in
your data source arrays, and then tell the outline view to reloadItem.
Do keep in mind that when you send reloadItem, you need to tell it the
actual item, not just a matching string.
John
On Thursday, June 20, 2002, at 01:07 PM, Ken Tozier wrote:
I'm writing the data source for my first outline view and I'm
completely
lost. I want it to display volatile data but I can't figure out how to
target specific cells in the outline (of the UI) for updating.
Here's the sequence of events I'm looking for:
1. External process notifies data source of a change (easy)
2. Data source propagates change to all relevant sub-objects (easy)
3. Sub-objects propagate change to all relevant fields (easy)
4. Individual fields tell their UI counterparts to update (no clue)
I'm guessing I need to implement
- (void)outlineView:(NSOutlineView *)outlineView
setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn
byItem:(id)item
but I don't have a clue how to get the "item" reference of the
"byItem:"
argument. This is an input parameter isn't it? And as such the only
thing that can supply this reference is the UI itself, no? Seems like a
Catch 22 to me.
In a nutshell, I don't understand how to make data source events drive
the UI as opposed to having UI events drive the data source. If one
cell
in a large data source changes, I don't want to have to refresh the
whole dang thing.
Thanks for any help.
Ken Tozier
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.