NSOutlineView with NSTreeController bindings - default expansion for nodes
NSOutlineView with NSTreeController bindings - default expansion for nodes
- Subject: NSOutlineView with NSTreeController bindings - default expansion for nodes
- From: Luke Evans <email@hidden>
- Date: Sun, 10 Feb 2008 16:25:29 -0800
I have not yet found anything in the docs indicating a way to set the
default expansion state for outline nodes introduced into my tree from
my model (via the bound NSTreeController).
Of course I can find out when an outline node is about to be
displayed, and could arrange for the newly added item to be expanded
'later' (performing this on a later runloop event), but in order to
avoid having the given item always expanded, I'd have to record
whether or not this has been done before - probably in my model
object, which seems wrong (e.g. what if I want to use my model objects
in several trees, and why should my model object really be maintaining
state about the view?).
If I'm only concerned about the top level (root) objects, then I can
presumably whip through these expanding them, once the control is
initialised and the NSTreeController has its content, but even this
would not interact too favourably if I've opted to persist the state
with autosaveExpandedItems.
Really, I need some way to determine that an item is being added to
the outline for the very first time to have an opportunity to assert
its initial expansion state, but never touch it again thereafter. At
the moment, this is looking quite awkward, but perhaps there's some
magic...?
-- Lwe
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden