wxJoystick SetCapture() and ReleaseCapture() question

Hi all,

I wrote an wx application with wxPython 2.4.2.4u under Win32 (XP) that uses a USB-connected joystick. The main application frame window creates a joystick object by creating a wx.Joystick() and then calls SetCapture() on this object. The application works fine: it receives joystick events and can process them properly.

Now I noticed that if I run my application *and* the wxPython Joystick demo, *both* application receive the Joystick events notifications!

In my application I would like to create several windows, and activate joystick events for only one window at a time.

To test this capability I tried to call ReleaseCapture() in an attempt to stop receiving Joystick events in one window. It works, but then when I call SetCapture() again, the call fails.

How can I control which window will be affected by the Joystick events?

Thanks in advance.

Pierre Rouleau

Pierre Rouleau wrote:

Hi all,

I wrote an wx application with wxPython 2.4.2.4u under Win32 (XP) that uses a USB-connected joystick. The main application frame window creates a joystick object by creating a wx.Joystick() and then calls SetCapture() on this object. The application works fine: it receives joystick events and can process them properly.

Now I noticed that if I run my application *and* the wxPython Joystick demo, *both* application receive the Joystick events notifications!

In my application I would like to create several windows, and activate joystick events for only one window at a time.

To test this capability I tried to call ReleaseCapture() in an attempt to stop receiving Joystick events in one window. It works, but then when I call SetCapture() again, the call fails.

How can I control which window will be affected by the Joystick events?

I don't know much about joysticks, please ask about this on wx-users.

ยทยทยท

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