thanks to the answers of my previous post I was able to
create a ComboBox based on wxComboCtrl plus wxListCtrl (based on the official 2.8 example),
with Mousewheel handling and any feature my old ComboBox had.
The only problem left is that I can't capture any EVT_CHAR event on the ComboPopup or
on the wxListCtrl.
The wxTextCtrl of the wxComboCtrl constantly has the focus, even if the wxComboPopup is shown,
but doesn't recieve the EVT_CHAR events either. Only if I click inside the TextCtrl itself and start typing
it will recieve the events.
How can I capture EVT_CHAR events on the wxListCtrl?
Am I doing something fundamentally wrong?
Best regards and thanks for the answers to my last posting.
--
Hannes Tismer
Software Development
Medical Display Solutions
Rein EDV GmbH Jakob-Krebs-Straße 124
D-47877 Willich
The wxTextCtrl of the wxComboCtrl constantly has the focus, even if the wxComboPopup is shown,
but doesn't recieve the EVT_CHAR events either. Only if I click inside the TextCtrl itself and start typing
it will recieve the events.
How can I capture EVT_CHAR events on the wxListCtrl?
Am I doing something fundamentally wrong?
I'm not sure what is going on, and I am not able to test right now, but you may want to try getting EVT_KEY_DOWN events instead.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Additionally I just noticed that after upgrading to wxPython
wx-2.8-msw-ansi 2.8.0.1 the MiniFrame my application has
doesn't fire any EVT_CHAR events anymore, either.
Hannes Tismer schrieb:
···
Hey friends,
thanks to the answers of my previous post I was able to
create a ComboBox based on wxComboCtrl plus wxListCtrl (based on the official 2.8 example),
with Mousewheel handling and any feature my old ComboBox had.
The only problem left is that I can't capture any EVT_CHAR event on the ComboPopup or
on the wxListCtrl.
I've tried it with the following snippet:
####
CRMAStyle = wx.LC_REPORT|wx.LC_HRULES|wx.LC_VRULES | wx.LC_SORT_DESCENDING | wx.LC_SINGLE_SEL | wx.WANTS_CHARS #| wx.LC_NO_HEADER
self.comboBox1 = wx.combo.ComboCtrl(id=wx.NewId(), name='listtest', style=CRMAStyle, parent=self, pos=wx.Point(30, 170),
size=wx.Size(410, 21), value=u'')
popup = ListCtrlComboPopup(CRMAStyle)
self.comboBox1.SetPopupMaxHeight(350)
self.comboBox1.SetPopupControl(popup)
The wxTextCtrl of the wxComboCtrl constantly has the focus, even if the wxComboPopup is shown,
but doesn't recieve the EVT_CHAR events either. Only if I click inside the TextCtrl itself and start typing
it will recieve the events.
How can I capture EVT_CHAR events on the wxListCtrl?
Am I doing something fundamentally wrong?
Best regards and thanks for the answers to my last posting.
--
Hannes Tismer
Software Development
Medical Display Solutions
Rein EDV GmbH Jakob-Krebs-Straße 124
D-47877 Willich
Well, thank you Robin, EVT_KEY_DOWN works for the wxListCtrl.
A current snippet for a working example of using wxComboCtrl + wxComboPopup(wxListCtrl)
on wxPython 2.8.0.1 with keyboard capturing on both the TextCtrl of wxComboCtrl and the ListCtrl:
···
###
# "textparent" is the wxTextCtrl recieved from wxComboCtrl.GetTextCtrl(); "self" is the instance of
# ListCtrlComboPopup(wx.ListCtrl, wx.combo.ComboPopup, listmix.ColumnSorterMixin)
def bindEvents(self):
self.textparent.Bind(wx.EVT_CHAR, self.OnPopupChar)
self.Bind(wx.EVT_KEY_DOWN, self.OnPopupChar)
self.textparent.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)
self.Bind(wx.EVT_MOTION, self.OnMotion)
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
self.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)
def OnPopupChar(self, evt):
keycode = evt.GetKeyCode()
etype = evt.GetEventType()
if etype == wx.wxEVT_CHAR:
# fired from "real" textctrl
# we can't test for "textctrl" GetEventObject(), because somehow wxTextCtrl
# continously has focus and fires the events for all three classes (wxComboCtrl, wxTextCtrl, wxComboPopup)
if keycode == wx.WXK_ESCAPE:
return self.core.onAppChar(evt)
elif etype == wx.wxEVT_KEY_DOWN:
if keycode == wx.WXK_ESCAPE:
self.Dismiss()
evt.Skip()
###
Additionally my last reply according to wxMiniFrame also seems to having lost EVT_CHAR firing ability I can now say
that EVT_KEY_DOWN compensates that - still I HAVE used EVT_CHAR on the MiniFrame with wx 2.6 (didn't change anything except
the wx Version).
Thanks
Hannes Tismer schrieb:
Additionally I just noticed that after upgrading to wxPython
wx-2.8-msw-ansi 2.8.0.1 the MiniFrame my application has
doesn't fire any EVT_CHAR events anymore, either.
Hannes Tismer schrieb:
Hey friends,
thanks to the answers of my previous post I was able to
create a ComboBox based on wxComboCtrl plus wxListCtrl (based on the official 2.8 example),
with Mousewheel handling and any feature my old ComboBox had.
The only problem left is that I can't capture any EVT_CHAR event on the ComboPopup or
on the wxListCtrl.
I've tried it with the following snippet:
####
CRMAStyle = wx.LC_REPORT|wx.LC_HRULES|wx.LC_VRULES | wx.LC_SORT_DESCENDING | wx.LC_SINGLE_SEL | wx.WANTS_CHARS #| wx.LC_NO_HEADER
self.comboBox1 = wx.combo.ComboCtrl(id=wx.NewId(), name='listtest', style=CRMAStyle, parent=self, pos=wx.Point(30, 170),
size=wx.Size(410, 21), value=u'')
popup = ListCtrlComboPopup(CRMAStyle)
self.comboBox1.SetPopupMaxHeight(350)
self.comboBox1.SetPopupControl(popup)
The wxTextCtrl of the wxComboCtrl constantly has the focus, even if the wxComboPopup is shown,
but doesn't recieve the EVT_CHAR events either. Only if I click inside the TextCtrl itself and start typing
it will recieve the events.
How can I capture EVT_CHAR events on the wxListCtrl?
Am I doing something fundamentally wrong?
Best regards and thanks for the answers to my last posting.
--
Hannes Tismer
Software Development
Medical Display Solutions
Rein EDV GmbH Jakob-Krebs-Straße 124
D-47877 Willich
Additionally my last reply according to wxMiniFrame also seems to having lost EVT_CHAR firing ability I can now say
that EVT_KEY_DOWN compensates that - still I HAVE used EVT_CHAR on the MiniFrame with wx 2.6 (didn't change anything except
the wx Version).
Which platform is this? What styles is the mini frame created with? What widgets does it have within it, and which one has the focus?
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
- Windows XP (SP2),
- wx.WANTS_CHARS | wx.TAB_TRAVERSAL | wx.STAY_ON_TOP | wx.DEFAULT_FRAME_STYLE | wx.MAXIMIZE_BOX | wx.FRAME_FLOAT_ON_PARENT | wx.MINIMIZE_BOX
- five wxTextCtrls, one wxCheckBox and one wxStaticText
It's a miniframe which is "opened" (shown) by the event of a buttonpress. Perhaps it may help you if i told you
that the miniframe's widgets get added as children to the parent motherframe, to build a tabtraversal:
for child in self.GetChildren():
if not hasattr(child, 'GetValue'):
continue
setattr(obj, child.GetName(), child)
# set title as default value carrier
child.defval = str(child.GetValue())
Robin Dunn schrieb:
···
Hannes Tismer wrote:
Additionally my last reply according to wxMiniFrame also seems to having lost EVT_CHAR firing ability I can now say
that EVT_KEY_DOWN compensates that - still I HAVE used EVT_CHAR on the MiniFrame with wx 2.6 (didn't change anything except
the wx Version).
Which platform is this? What styles is the mini frame created with? What widgets does it have within it, and which one has the focus?
--
Hannes Tismer
Software Development
Medical Display Solutions
Rein EDV GmbH Jakob-Krebs-Straße 124
D-47877 Willich
Additionally my last reply according to wxMiniFrame also seems to having lost EVT_CHAR firing ability I can now say
that EVT_KEY_DOWN compensates that - still I HAVE used EVT_CHAR on the MiniFrame with wx 2.6 (didn't change anything except
the wx Version).
Which platform is this? What styles is the mini frame created with? What widgets does it have within it, and which one has the focus?
- Windows XP (SP2),
- wx.WANTS_CHARS | wx.TAB_TRAVERSAL | wx.STAY_ON_TOP | wx.DEFAULT_FRAME_STYLE | wx.MAXIMIZE_BOX | wx.FRAME_FLOAT_ON_PARENT | wx.MINIMIZE_BOX
- five wxTextCtrls, one wxCheckBox and one wxStaticText
It's a miniframe which is "opened" (shown) by the event of a buttonpress. Perhaps it may help you if i told you
that the miniframe's widgets get added as children to the parent motherframe, to build a tabtraversal:
I'm not sure what you mean by this, can you make a small sample app that shows the problem?
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!