CustomTreeControl cancel label edit

Hi Kyle,

···

On Dec 13, 2007 6:23 PM, Robin Dunn wrote:

Rickey, Kyle W wrote:
> I've got a binding to:
>
> self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnEndLabelEdit)
>
> def OnEndLabelEdit(self, event):
> print event.IsEditCancelled()
>
> However IsEditCancelled always evaluates to True. In what case does it
> become False? I would like to check so that when the user presses ESC,
> the label editing is cancelled, but when they press ENTER, the label is
> committed. The enter press works good thanks to some code from Robin
> Dunn:
>
> self.Bind(wx.EVT_NAVIGATION_KEY, self.OnTreeNavigate)
>
> def OnTreeNavigate(self, event):
> if self.tree.GetEditControl():
> self.tree.GetEditControl().AcceptChanges()
> self.tree.GetEditControl().StopEditing()

This shouldn't be needed anymore in the latest version since it is using
the wx.WANTS_CAHRS style. Try removing it and then testing your
EndLabelEdit again. The IsEditCanceled seems to be doing the right
thing in the demo for me.

Yes, I have implemented this modification before the latest wxPython
release... it seems to do the right thing also for me. Can you please
try to upgrade to the latest wxPython and see if it works?

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

Robin, Andrea,

That did the trick, I was still using 2.8.4.0. IsEditCancelled works as
expected now. Now another question, does the edit control from
self.tree.GetEditControl() now have the wx.TE_MULTILINE style? I see
what looks to be like a small scrollbar when I edit labels in the demo.
Is there any way to disable that?

-Kyle Rickey

···

-----Original Message-----
From: Andrea Gavana [mailto:andrea.gavana@gmail.com]
Sent: Thursday, December 13, 2007 1:29 PM
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] CustomTreeControl cancel label edit

Hi Kyle,

On Dec 13, 2007 6:23 PM, Robin Dunn wrote:

Rickey, Kyle W wrote:
> I've got a binding to:
>
> self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnEndLabelEdit)
>
> def OnEndLabelEdit(self, event):
> print event.IsEditCancelled()
>
> However IsEditCancelled always evaluates to True. In what case does

it

> become False? I would like to check so that when the user presses

ESC,

> the label editing is cancelled, but when they press ENTER, the label

is

> committed. The enter press works good thanks to some code from Robin
> Dunn:
>
> self.Bind(wx.EVT_NAVIGATION_KEY, self.OnTreeNavigate)
>
> def OnTreeNavigate(self, event):
> if self.tree.GetEditControl():
> self.tree.GetEditControl().AcceptChanges()
> self.tree.GetEditControl().StopEditing()

This shouldn't be needed anymore in the latest version since it is

using

the wx.WANTS_CAHRS style. Try removing it and then testing your
EndLabelEdit again. The IsEditCanceled seems to be doing the right
thing in the demo for me.

Yes, I have implemented this modification before the latest wxPython
release... it seems to do the right thing also for me. Can you please
try to upgrade to the latest wxPython and see if it works?

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org