Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » TreeCtrl » PROPOSAL: TreeCtrl optionally owns Ctrl's in Node
PROPOSAL: TreeCtrl optionally owns Ctrl's in Node [message #30202] Wed, 15 December 2010 15:52 Go to next message
kohait00 is currently offline  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
  • Attachment: TreeCtrl.h
    (Size: 16.16KB, Downloaded 403 times)
  • Attachment: TreeCtrl.cpp
    (Size: 36.67KB, Downloaded 383 times)

[Updated on: Wed, 15 December 2010 21:31]

Report message to a moderator

Re: PROPOSAL: TreeCtrl optionally owns Ctrl's in Node [message #30601 is a reply to message #30202] Tue, 11 January 2011 15:03 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
any advances on that one?
Re: PROPOSAL: TreeCtrl optionally owns Ctrl's in Node [message #30670 is a reply to message #30601] Sun, 16 January 2011 11:26 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
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).
Re: PROPOSAL: TreeCtrl optionally owns Ctrl's in Node [message #30720 is a reply to message #30670] Tue, 18 January 2011 10:38 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
not quite sure about the demand. see the downloads of the file... Smile

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)

ps: thanks for the improvements on arrayctrl
Re: PROPOSAL: TreeCtrl optionally owns Ctrl's in Node [message #30749 is a reply to message #30720] Thu, 20 January 2011 14:32 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Could send me some file so that I can test it?

(Sorry for asking, too lazy to clober together one and I believe you must have had something like for debugging it Smile

Mirek
Re: PROPOSAL: TreeCtrl optionally owns Ctrl's in Node [message #30754 is a reply to message #30749] Thu, 20 January 2011 15:40 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
thanks for taking on it..
here again a complete packet, based on current revision

i think the major problem is the DND stuff, which uses copies of Node instances. while ArrayCtrl moves them i think.
  • Attachment: TreeCtrl.rar
    (Size: 13.97KB, Downloaded 369 times)

[Updated on: Thu, 20 January 2011 15:48]

Report message to a moderator

Re: PROPOSAL: TreeCtrl optionally owns Ctrl's in Node [message #32530 is a reply to message #30754] Mon, 23 May 2011 22:57 Go to previous messageGo to next message
kohait00 is currently offline  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..

any idea? i dont know what'd be better.
Re: PROPOSAL: TreeCtrl optionally owns Ctrl's in Node [message #32683 is a reply to message #32530] Wed, 01 June 2011 20:49 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
kohait00 wrote on Mon, 23 May 2011 16:57

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" Smile

I mean, do not support "predefined" DnD ops for Ctrl owning TreeCtrl. If programmer wants this, he needs to provide his specialized methods.

Mirek
Previous Topic: Changing tree control style
Next Topic: PROPOSAL : allow inserting and retrieving of classes DERIVED from TreeCtrl::Node
Goto Forum:
  


Current Time: Thu Mar 28 09:40:56 CET 2024

Total time taken to generate the page: 0.02432 seconds