While playing around with the new wxComboCtrl control and extending
its behaviour I've noticed that there are weird things happening with SetMark()
applied on wx.ComboCtrl.GetTextCtrl().
In the official manual wxComboCtrl should use SetSelection() for selecting text
inside the TC - wxPython uses SetMark() on wxTextCtrl as substitute for this.
The following example sets the mark perfectly:
elif etype == wx.wxEVT_LEFT_DOWN:
# textctrl doesnt have focus - wxMSW specific
if tc.GetInsertionPoint() == 0:
tc.SetFocus()
tc.SetMark(0, tc.GetLastPosition())
While raising:
AttributeError: 'TextCtrl' object has no attribute 'SetMark'
Excepting AttributeError around SetMark() leads to not marking the text.
···
--
Hannes Tismer
Software Development
Medical Display Solutions
Rein EDV GmbH Jakob-Krebs-Straße 124
D-47877 Willich
While playing around with the new wxComboCtrl control and extending
its behaviour I've noticed that there are weird things happening with SetMark()
applied on wx.ComboCtrl.GetTextCtrl().
In the official manual wxComboCtrl should use SetSelection() for selecting text
inside the TC - wxPython uses SetMark() on wxTextCtrl as substitute for this.
The following example sets the mark perfectly:
elif etype == wx.wxEVT_LEFT_DOWN:
# textctrl doesnt have focus - wxMSW specific
if tc.GetInsertionPoint() == 0:
tc.SetFocus()
tc.SetMark(0, tc.GetLastPosition())
While raising:
AttributeError: 'TextCtrl' object has no attribute 'SetMark'
You should use SetSelection for textCtrl. The combo controls have the C++ SetSelection(start, end) renamed to SetMark because they also have an overloaded SetSelection(n) inherited from ControlWithItems and renaming is how I tend to handle overloads
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
While playing around with the new wxComboCtrl control and extending
its behaviour I've noticed that there are weird things happening with SetMark()
applied on wx.ComboCtrl.GetTextCtrl().
In the official manual wxComboCtrl should use SetSelection() for selecting text
inside the TC - wxPython uses SetMark() on wxTextCtrl as substitute for this.
The following example sets the mark perfectly:
elif etype == wx.wxEVT_LEFT_DOWN:
# textctrl doesnt have focus - wxMSW specific
if tc.GetInsertionPoint() == 0:
tc.SetFocus()
tc.SetMark(0, tc.GetLastPosition())
While raising:
AttributeError: 'TextCtrl' object has no attribute 'SetMark'
You should use SetSelection for textCtrl. The combo controls have the C++ SetSelection(start, end) renamed to SetMark because they also have an overloaded SetSelection(n) inherited from ControlWithItems and renaming is how I tend to handle overloads
--
Hannes Tismer
Software Development
Medical Display Solutions
Rein EDV GmbH Jakob-Krebs-Straße 124
D-47877 Willich