lipid
September 22, 2003, 9:20am
1
I'm trying to create a custom control which acts as a slider and sends
wxEVT_COMMAND_SLIDER_UPDATED events, but I haven't been able to figure out
the correct way of doing so.
I looked at the wiki page on custom controls
(http://wiki.wxpython.org/index.cgi/BuildingControls ) and based on that
tried (within the custom control):
evt = wxCommandEvent(self.GetId(), self.GetValue())
self.GetEventHandler().ProcessEvent(evt)
I figured I must need to set the event type, but the documentation on
creating events like this seems poor. I tried:
evt = wxCommandEvent(self.GetId(), self.GetValue())
evt.m_eventType = wxEVT_COMMAND_SLIDER_UPDATED
self.GetEventHandler().ProcessEvent(evt)
Which doesn't work either. I'm not sure whether I'm misunderstanding the
process, or just failing to create the right event object.
Robin
September 22, 2003, 8:47pm
2
lipid@68k.org wrote:
I'm trying to create a custom control which acts as a slider and sends
wxEVT_COMMAND_SLIDER_UPDATED events, but I haven't been able to figure out
the correct way of doing so.
I looked at the wiki page on custom controls
(http://wiki.wxpython.org/index.cgi/BuildingControls ) and based on that
tried (within the custom control):
evt = wxCommandEvent(self.GetId(), self.GetValue())
self.GetEventHandler().ProcessEvent(evt)
I figured I must need to set the event type, but the documentation on
creating events like this seems poor. I tried:
evt = wxCommandEvent(self.GetId(), self.GetValue())
evt.m_eventType = wxEVT_COMMAND_SLIDER_UPDATED
self.GetEventHandler().ProcessEvent(evt)
Which doesn't work either.
It should be something like this:
evt = wxCommandEvent(wxEVT_COMMAND_SLIDER_UPDATED, self.GetId())
evt.SetInt(self.GetValue())
evt.SetEventObject(self)
self.GetEventHandler().ProcessEvent(evt)
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!