"Edward Stow" <[hidden email]> wrote in message
> Hello all
> How can you configure a TreeView so that a user cannot collapse the
> tree nodes.
> I still want the view enabled so that selections and context menus
The TreeView wrapper in Dolphin's MVP framework doesn't expose a hook to
enable you to do this without either modifying it or subclassing it. The
simplest approach would be to subclass it and override #tvnItemExpanding: by
copying down the superclass implementation and then modifying the line:
nmtv action = TVE_EXPAND ifFalse: [^nil]
to say instead:
nmtv action = TVE_EXPAND ifFalse: [^true].
This will certainly prevent items being collapsed, but may have other
unwanted effects, so it might be better to only return true on receipt of
TVE_COLLAPSE. Oh, and I think an audible warning that the users action is
being ignored would provide a better user experience as well.
Ideally, of course, an event should be triggered so that observers could
control whether or not nodes can be expanded or contracted. We'll attend to
that in a future release.