handling mouse move events over button

Hello,
I would like to know how to handle the wx.EVT_MOTION event for a button,
to be specific to a large group of buttons.
The handler for wx.EVT_LEFT_DOWN is called but not for wx.EVT_MOTION

The problem that I am facing is that I have a large number of buttons in
a panel I am trying to scroll that panel (without using scrolledwindow)
left or right depending on the mouse drag. Scrolling works if the motion
event is on the panel, but if the motion event is on a button it fails.

Is there any way to change the propagation of events? i.e instead of
Child to parent I would like to have it has parent to child.

regards

···

--
Joshua Immanuel
HiPro IT Solutions Pvt. Ltd.
http://hipro.co.in

Joshua Immanuel wrote:

Hello,
I would like to know how to handle the wx.EVT_MOTION event for a button,
to be specific to a large group of buttons.
The handler for wx.EVT_LEFT_DOWN is called but not for wx.EVT_MOTION

The problem that I am facing is that I have a large number of buttons in
a panel I am trying to scroll that panel (without using scrolledwindow)
left or right depending on the mouse drag. Scrolling works if the motion
event is on the panel, but if the motion event is on a button it fails.

Is there any way to change the propagation of events? i.e instead of
Child to parent I would like to have it has parent to child.

regards
  
Off the top of my head, I would just stick all the buttons into a list and then do a quick and dirty iteration over the buttons, binding each to EVT_MOTION.

Some of the people on the list create helper classes / functions for widget creation and you could do it that way too.

···

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

Joshua Immanuel wrote:

Hello,
I would like to know how to handle the wx.EVT_MOTION event for a button,
to be specific to a large group of buttons.
The handler for wx.EVT_LEFT_DOWN is called but not for wx.EVT_MOTION

The problem that I am facing is that I have a large number of buttons in
a panel I am trying to scroll that panel (without using scrolledwindow)
left or right depending on the mouse drag. Scrolling works if the motion
event is on the panel, but if the motion event is on a button it fails.

Is there any way to change the propagation of events?

You can, but since they are not command events you will still need to
catch the events in the buttons to be able to tell wx to propagate them
up to th parent, so you may as well just do your work in the button's
event handler.

···

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