Hi, sorry, for the previous post (caught in a different thread).
I'm using a wxTreeCtrl, and I would like to be able to move around elements of
tree by Drag'N'Drop, does any one have some examples on how to do that ?
Thanks
Przemek
···
--
Przemysław G. Gawroński
Informatyk - Dział Telemetrii
TNS OBOP
tel.: (0 22) 648 30 71, (0 22) 648 20 44 (-46)
fax: (0 22) 644 99 47
mailto:P.Gawronski@obop.pl
http://www.obop.com.pl/
----------------------------------------------------------------------
Najnowsze dane pochodzące ze światowego badania handlu internetowego!
Global eCommerce Report 2002
http://www2.obop.com.pl/images/GER2002FinalReport.pdf
----------------------------------------------------------------------
_______________________________________________________________________
Uwaga: Ta wiadomosc poczty elektronicznej przeznaczona jest wylacznie
dla osoby/firmy wymienionej powyzej. Tresc wiadomosci jest poufna i
prawnie chroniona. Jesli - przez pomylke - otrzymali Panstwo te
wiadomosc, uprzejmie prosimy (1) niezwlocznie skontaktowac sie z nasza
firma, (2) zniszczyc wiadomosc i wszystkie zalaczniki oraz (3) upewnic
sie, ze jej tresc nie zostala ujawniona ani wykorzystana.
Dziekujemy. TNS OBOP
---
Note: This electronic mail message is for the use of the person
or company named above only. This message is CONFIDENTIAL and may be
LEGALLY PRIVILEGED. If you have received this message in error, please
contact us immediately, destroy the message and all the attachments
received, ensure that their contents are not disclosed or used.
I've never done anything with the drag/drop on wxTreeCtrls, but I have
some code that I wrote that does the `move around elements' part--I'll
dig it out and post it, tonight (unless someone else posts first);
then maybe we can help you with the the drag/drop part.
···
On Wed, Jul 31, 2002 at 03:15:36PM +0200, TNS OBOP wrote:
I'm using a wxTreeCtrl, and I would like to be able to move around
elements of tree by Drag'N'Drop, does any one have some examples on
how to do that ?
--
"Everyone can be taught to sculpt:
Michelangelo would have had to be taught not to.
So it is with great programmers." --Alan Perlis
Here's a method (defined on a class derived from wxTreeCtrl) to move nodes:
def reparent_node(self, node, parent):
nodedata = self.GetPyData(node)
newnode = self.AppendItem(parent,
self.GetItemText(node),
-1, -1,
wxTreeItemData(nodedata))
# if you've stored references to the old node anywhere,
# you want to replace them with references to the new node, here,
# otherwise they'll all be broken when this method completes,
# and may lead to Python crashing.
# Also: if you have things happening in multiple threads,
# you probably want to insert locks at the appropriate places.
if self.ItemHasChildren(node):
self.SetItemHasChildren(newnode)
if self.IsExpanded(node):
self.Expand(newnode)
cookie = 0
while 1:
child, cookie = self.GetFirstChild(node, cookie)
if not child.IsOk():
break
self.reparent_node(child, newnode)
self.Delete(node)
return newnode
···
On Wed, Jul 31, 2002 at 09:50:30AM -0400, Joshua Judson Rosen wrote:
On Wed, Jul 31, 2002 at 03:15:36PM +0200, TNS OBOP wrote:
>
> I'm using a wxTreeCtrl, and I would like to be able to move around
> elements of tree by Drag'N'Drop, does any one have some examples on
> how to do that ?
I've never done anything with the drag/drop on wxTreeCtrls, but I have
some code that I wrote that does the `move around elements' part--I'll
dig it out and post it, tonight (unless someone else posts first);
then maybe we can help you with the the drag/drop part.
--
"Everyone can be taught to sculpt:
Michelangelo would have had to be taught not to.
So it is with great programmers." --Alan Perlis
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users
--
"A picture is worth 10K words -
but only those to describe the picture.
Hardly any sets of 10K words
can be adequately described with pictures." --Alan Perlis