Actually, I've just narrowed down the problem a bit more. Highlight an
item, press F2, press Ctrl-C, press Enter. Now, press F2 again, then
Ctrl-V, there is a \n character.
Now, try this: highlight an item, press F2, press End. Now hold Shift
and press Home, press Ctrl-C. Now when that is pasted, there is not \n
character. I wonder if this is specific to MSW?
···
-----Original Message-----
From: Rickey, Kyle W
Sent: Wednesday, February 06, 2008 3:35 PM
To: wxPython-users@lists.wxwidgets.org
Subject: RE: [wxPython-users] CustomTreeCtrl Edit Labels Bug?
Andrea, how about this one. When editing labels by pressing F2, I set
the selection of the editcontrol with
self.tree.GetEditControl().SetSelection(-1, -1)
Now, run the following, highlight a tree item, hit F2, then paste some
text. On MSW, this appends an extra \n character. Is this a problem with
my code or something else? I supposed I could add a check when
wx.EVT_TREE_END_LABEL_EDIT is sent and remove the extra \n. Any
thoughts?
import wx
import wx.lib.customtreectrl as CT
class MainWindow(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, wx.ID_ANY, title)
self.tree = CT.CustomTreeCtrl(self, -1,
style=wx.TR_DEFAULT_STYLE|wx.TR_HAS_BUTTONS|
wx.TR_FULL_ROW_HIGHLIGHT|wx.TR_MULTIPLE|wx.TR_EDIT_LABELS|
wx.TR_HAS_VARIABLE_ROW_HEIGHT)
root = self.tree.AddRoot("Root Item")
for x in range(0, 7):
self.tree.AppendItem(root, "Some Long Item
"+str(x))
self.tree.Expand(root)
self.tree.Bind(wx.EVT_TREE_KEY_DOWN, self.OnKeyDown)
self.Center()
self.Show()
def OnKeyDown(self, event):
key = event.GetKeyEvent().GetKeyCode()
if key == wx.WXK_F2:
item = self.tree.GetSelection()
self.tree.EditLabel(item)
self.tree.GetEditControl().SetSelection(-1, -1)
else:
event.Skip()
app = wx.App(0)
frame = MainWindow(None, -1, "Test Edit Control")
app.MainLoop()
-Kyle Rickey
-----Original Message-----
From: Andrea Gavana [mailto:andrea.gavana@gmail.com]
Sent: Wednesday, January 30, 2008 2:26 PM
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] CustomTreeCtrl Edit Labels Bug?
Hi Kyle,
On Jan 30, 2008 9:20 PM, Rickey, Kyle W wrote:
Using wxpython 2.8.7.1 on window xp and python 2.5
When editing labels in the custromtreectrl, if text is selected when
you
press enter, whatever was selected is deleted. Is this a bug? This
does
not happen when I press escape or click on another tree item.
import wx
import wx.lib.customtreectrl as CT
class MainWindow(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, wx.ID_ANY, title)
self.tree = CT.CustomTreeCtrl(self, -1,
style=wx.TR_DEFAULT_STYLE|wx.TR_HAS_BUTTONS|
wx.TR_FULL_ROW_HIGHLIGHT|wx.TR_MULTIPLE|wx.TR_EDIT_LABELS|
wx.TR_HAS_VARIABLE_ROW_HEIGHT)
root = self.tree.AddRoot("Root Item")
for x in range(0, 7):
self.tree.AppendItem(root, "Some Long Item
"+str(x))
self.tree.Expand(root)
self.Center()
self.Show()
app = wx.App(0)
frame = MainWindow(None, -1, "Test Edit Control")
app.MainLoop()
Yes, it's a bug
. I am updating the SVN right now, I'll work on it
and I will report back when it's fixed.
Thank you for the bug report!
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
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org