Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOutlineView: getting index of drawn row in outlineView:willDispayCell:



Ilja A. Iwas wrote on Thursday, July 13, 2006:

>Hi there,
>
>depending on what row index is getting redrawn, I'd like to alter the  
>appearance of the row.  The outline view also contains smart groups,  
>which cause the same items to be included at several different  
>locations in the outline view simultaneously.
>
>I'm altering the parameters of the cell in  
>outlineView:willDisplayCell:forTableColumn:item:. Unfortunately I  
>cannot use NSOutlineView's rowForItem: method, since it seems to  
>return the any out of the rows for an item, which is not necessarily  
>the row being redrawn.
>
>Any ideas how I could determine the index of the redrawn row from  
>inside the willDisplayCell delegate method?

Not to suggest that you completely rewrite your application but ...

I've solved this in the past by creating a lightweight view object that I use for my item nodes in the outline. The view object references the original, encapsulates a lot of the model->view translation (like constructing the node's display name), and -- most importantly -- it contains a parent pointer to the super-node that owns it in the outline. This allows me to easily traverse the outline tree to find the node's context.

-- 
James Bucanek
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >NSOutlineView: getting index of drawn row in outlineView:willDispayCell: (From: "Ilja A. Iwas" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.