I've got a wx.ComboBox that I'm creating like:
self.box1 = wx.ComboBox(self, -1, choices=prefs['find'], size=(125,
-1), style=wx.TE_PROCESS_ENTER)
I sometimes later populate it like:
self.box1.SetValue(x)
Then to ensure that all of the text is selected and the box has focus...
self.box1.SetFocus()
self.box1.SetMark(0, self.box1.GetLastPosition())
It would seem that on Linux using Python 2.6.5 and wxPython 2.8.10.1
(gtk2-unicode), self.box1.GetLastPosition() returns a value that is 1
shorter than the actual value in the box, so all but the last
character is selected. By simply changing that last line to...
self.box1.SetMark(0, len(self.box1.GetValue()))
I'm able to work-around it, as len() returns the proper value.
As far as I can tell, this isn't an issue in Windows. Anyone else run
into the problem?
I've confirmed that it is a bug in 2.8.11.0, but it looks like it has been fixed already in 2.9
···
On 11/24/10 11:12 PM, Josiah Carlson wrote:
I've got a wx.ComboBox that I'm creating like:
self.box1 = wx.ComboBox(self, -1, choices=prefs['find'], size=(125,
-1), style=wx.TE_PROCESS_ENTER)
I sometimes later populate it like:
self.box1.SetValue(x)
Then to ensure that all of the text is selected and the box has focus...
self.box1.SetFocus()
self.box1.SetMark(0, self.box1.GetLastPosition())
It would seem that on Linux using Python 2.6.5 and wxPython 2.8.10.1
(gtk2-unicode), self.box1.GetLastPosition() returns a value that is 1
shorter than the actual value in the box, so all but the last
character is selected. By simply changing that last line to...
self.box1.SetMark(0, len(self.box1.GetValue()))
I'm able to work-around it, as len() returns the proper value.
As far as I can tell, this isn't an issue in Windows. Anyone else run
into the problem?
Awesome. Thank you Robin. Good to know that we are not crazy
- Josiah
···
On 11/27/10, Robin Dunn <robin@alldunn.com> wrote:
On 11/24/10 11:12 PM, Josiah Carlson wrote:
I've got a wx.ComboBox that I'm creating like:
self.box1 = wx.ComboBox(self, -1, choices=prefs['find'], size=(125,
-1), style=wx.TE_PROCESS_ENTER)
I sometimes later populate it like:
self.box1.SetValue(x)
Then to ensure that all of the text is selected and the box has focus...
self.box1.SetFocus()
self.box1.SetMark(0, self.box1.GetLastPosition())
It would seem that on Linux using Python 2.6.5 and wxPython 2.8.10.1
(gtk2-unicode), self.box1.GetLastPosition() returns a value that is 1
shorter than the actual value in the box, so all but the last
character is selected. By simply changing that last line to...
self.box1.SetMark(0, len(self.box1.GetValue()))
I'm able to work-around it, as len() returns the proper value.
As far as I can tell, this isn't an issue in Windows. Anyone else run
into the problem?
I've confirmed that it is a bug in 2.8.11.0, but it looks like it has
been fixed already in 2.9