[wxpython-dev] Patch for wx.lib.combotreebox.py

wxPython developer mailing list, post #651
Author:
Date:
Subject:
 Frank Niessink
 2008-05-02 21:01:27
 [wxpython-dev] Patch for wx.lib.combotreebox.py
Hi Robin,

I fixed a bug in wx.lib.combotreebox.py. The bug occurred if the tree
contained items with the same item text; if the user would click the
second item, the first would be erroneously selected. Attached patch
fixes this issue.

Cheers, Frank
*** combotreebox.orig.py 2008-05-02 20:53:35.000000000 +0200
--- combotreebox.py 2008-05-02 20:54:28.000000000 +0200
***************
*** 35,44 ****
workaround.

Author: Frank Niessink <[email protected]>
! Copyright 2006, Frank Niessink
License: wxWidgets license
! Version: 0.9
! Date: September 6, 2006
"""

import wx
--- 35,44 ----
workaround.

Author: Frank Niessink <[email protected]>
! Copyright 2006, 2008, Frank Niessink
License: wxWidgets license
! Version: 1.0
! Date: May 2, 2008
"""

import wx
***************
*** 362,373 ****

def OnText(self, event):
event.Skip()
! item = self.FindString(self._text.GetValue())
! if item:
! if self._tree.GetSelection() != item:
self._tree.SelectItem(item)
! else:
! self._tree.Unselect()

# Methods called by the PopupFrame, to let the ComboTreeBox know
# about what the user did.
--- 362,377 ----

def OnText(self, event):
event.Skip()
! textValue = self._text.GetValue()
! selection = self._tree.GetSelection()
! if not selection or self._tree.GetItemText(selection) != textValue:
! # We need to change the selection because it doesn't match the
! # text just entered
! item = self.FindString(textValue)
! if item:
self._tree.SelectItem(item)
! else:
! self._tree.Unselect()

# Methods called by the PopupFrame, to let the ComboTreeBox know
# about what the user did._______________________________________________
wxpython-dev mailing list
[email protected]
http://lists.wxwidgets.org/mailman/listinfo/wxpython-dev
Author:
Date:
Subject:
 Robin Dunn
 2008-05-02 12:29:36
 Re: [wxpython-dev] Patch for wx.lib.combotreebox.py
Frank Niessink wrote:
> Hi Robin,
>
> I fixed a bug in wx.lib.combotreebox.py. The bug occurred if the tree
> contained items with the same item text; if the user would click the
> second item, the first would be erroneously selected. Attached patch
> fixes this issue.

Thanks.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

_______________________________________________
wxpython-dev mailing list
[email protected]
http://lists.wxwidgets.org/mailman/listinfo/wxpython-dev