kohait00 Messages: 939 Registered: July 2009 Location: Germany
Experienced Contributor
hi all
ArrayCtrl has got the possibility to own the Ctrls if they are passed as pointer, so one can create some on the fly and have the TreeCtrl take care of their destruction. this is great for editing the represented values.
it does not break the 'everything-belongs-somewhere-rule'. TreeCtrl is then the container..
since these two, ArrayCtrl and TreeCtrl are the major complex grouping Ctrl's they should support it and be of similar skills.
what do you think?
EDIT: at first i thought it is easy task, since TreeCtrl is already setup as to have Ctrls, but not owned. but i realize that TreeCtrl::Node and TreeCtrl::Item handling is not fitting in design as to handle ownership.
maybe someone could help here. attached is the so far changed TreeCtrl sources
Well, I guess there is no real demand to introduce this now...
Frankly, in this department, much more pressing issue is optimization of how ArrayCtrl is handling widgets (it gets quite slow if there is enough lines).
kohait00 Messages: 939 Registered: July 2009 Location: Germany
Experienced Contributor
not quite sure about the demand. see the downloads of the file...
i think it's be great to have them both..not to have to take care of the controls you set up in the TreeCtrl is just a nice thing, keeping user code cleaner (no need to take care of add's and removes)
kohait00 Messages: 939 Registered: July 2009 Location: Germany
Experienced Contributor
i will be warming up this thing, but need an advice in which direction to go:
the key problem in TreeCtrl is that Node is meant to be passed around by-value, i.e. performing DnD movings or using the Copy() function..
when a Node references a Ctrl which it owns, it cant be passed around by-value, it either needs to be picked (dtor would take care of destruciton of Ctrl) or a different Method for Moving/DnD of the Nodes needs to be found to avoid copy which would duplicate the Node and double ownership. so Node might need to stay unmouvable (exposed only as const or have a subclass which actually holds the ctrl..
i will be warming up this thing, but need an advice in which direction to go:
the key problem in TreeCtrl is that Node is meant to be passed around by-value, i.e. performing DnD movings or using the Copy() function..
when a Node references a Ctrl which it owns, it cant be passed around by-value, it either needs to be picked (dtor would take care of destruciton of Ctrl) or a different Method for Moving/DnD of the Nodes needs to be found to avoid copy which would duplicate the Node and double ownership. so Node might need to stay unmouvable (exposed only as const or have a subclass which actually holds the ctrl..
any idea? i dont know what'd be better.
Well, general advice in this case is to "give up"
I mean, do not support "predefined" DnD ops for Ctrl owning TreeCtrl. If programmer wants this, he needs to provide his specialized methods.