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 » Nodes with Ctrl content disappear when Drag n Drop
Nodes with Ctrl content disappear when Drag n Drop [message #23433] Mon, 19 October 2009 09:26 Go to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
hi there,

using TreeCtrl with ctrl content in the nodes is just fine, though we still cant use the key approach to find the node with a key, if it contains a ctrl.

BUT: drag and drop reacts weired. the ctrl content simply disappears when dragging those elements. find attached a modified TreeCtrlDnD version, which uses EditString as content, and play around.

the problem here is the use of the Copy function (TreeCtrl.cpp:1701), no matter what action is performed. DND_MOVE should somehow preserve the ctrl, while DND_COPY freele can set the copy Node ctrl to NULL.

also it would be great, to have kind of a TreeCtrl based API method, which can *manually* move elements, something like

int Move(id src, int parent, int ii);


which can move a treeelement with src id, into another element, adressed with parent id and using its child position ii.
maybe this would be a nice feature for other Container Ctrls as well (ArrayCtrl, ColumnList, ...)

whis would give means to reorganize the tree (or basicly speaking the data base) in an easy way in code, without using the DragnDrop or Insert API, which breaks ctrl references

OTHER question:
the following Move workaround crasches in the Call of Remove(), why? (tGroups is a TreeCtrl, id is the to be moved element, moving to parent / ii), it works so far, leaving the dummy element, but removing causes an ASSERT

//insert a dummy so we can swap them, and delete the dummy
int id__ = tGroups.Insert(parent, ii, Image(), Value(0));
tGroups.Swap(id, id__);
tGroups.Remove(id); //ASSERT


any help greatly appreciated

Re: Nodes with Ctrl content disappear when Drag n Drop [message #23440 is a reply to message #23433] Mon, 19 October 2009 16:27 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
seems to be able, to manuellay move elements, even with ctrl content, with this workaround privided (a custom InsertDrop, together with a custom Move instead of Copy)..check out the TreeCtrlDnD example.
Re: Nodes with Ctrl content disappear when Drag n Drop [message #23462 is a reply to message #23440] Wed, 21 October 2009 09:00 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, I am afraid that the moral of the story is that D&D with widget nodes is too complex to be handled by common methods.

Back then when implementing this issue, we have expected that such cases should rather be managed by custom code, not using InsertDrop...

Mirek
Previous Topic: treectrl with ctrl
Next Topic: Blinking tree when opening or closing nodes
Goto Forum:
  


Current Time: Fri Mar 29 08:17:31 CET 2024

Total time taken to generate the page: 0.01831 seconds