[wxPython] Editing Labels in wxTreeCtrl

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[wxPython] Editing Labels in wxTreeCtrl

Sean Mc Grath-2
I have turned on lable editing with wxTR_EDIT_LABELS but the
item text is not being updated. When I hit return after
an edit, the lable text reverts to what it was before
the edit.

I hooked the end edit event and using that I can catch
the fact that the lable has been changed. I can also
set it to a new value:

def OnEndwxTreeLabelEdit(self, event):
        self.wxTree.SetItemText(self.wxTree.GetSelection(),"Foo")

My problem is this: how do I find out what the edited value
is? GetItemText() returns the pre-edit text.

regards,

<Sean uri="http://www.digitome.com/sean.html">
Developers Day co-Chair WWW9, April 2000, Amsterdam
<uri>http://www.www9.org</uri>
</Sean>




_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] Editing Labels in wxTreeCtrl

Robin Dunn


> I have turned on lable editing with wxTR_EDIT_LABELS but the
> item text is not being updated. When I hit return after
> an edit, the lable text reverts to what it was before
> the edit.
>
> I hooked the end edit event and using that I can catch
> the fact that the lable has been changed. I can also
> set it to a new value:
>
> def OnEndwxTreeLabelEdit(self, event):
> self.wxTree.SetItemText(self.wxTree.GetSelection(),"Foo")
>
> My problem is this: how do I find out what the edited value
> is? GetItemText() returns the pre-edit text.
>

See the demo.  There is a method in the event object (GetLabel I think) that
returns the new text.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users