views:

147

answers:

1

I'm developing an application that contains a number of panes. See the screenshot:

screenshot

  • The left settings pane is a wx.ScrolledPanel that contains a number of wx.Panels.
  • The top events pane is a wx.grid.Grid.
  • The bottom data pane is a wx.Panel that contains a wx.grid.Grid.
  • The middle plot pane is a wx.Panel containing an enthought chaco plot.
  • The right detector pane is a wx.Panel.

I would like to implement focus follows mouse so that when I move my mouse over the plot I can immediately zoom in or out using my scroll wheel without first clicking on the plot to give it the focus.

Similarly when I move my mouse over the left settings , the top events or the bottom data panes I would like to be able to immediately scroll the window using the scroll wheel without first clicking on the window.

Currently I defined a function:

def focusFollowsMouse(window):
    window.Bind(wx.EVT_ENTER_WINDOW, lambda event: window.SetFocus())

I would like to apply this function only on the four top-level panes: plot, settings, events and data.

However I need to call this function for each sub-panel or control in each of the top-level panes to get this to work. For example I need to apply this function individually to the Measurement Settings, Analysis Parameters, View Settings etc. panels.

Most likely the EVT_ENTER_WINDOW event is not propagated to parent windows.

Is there a way to get this to work without applying focusFollowsMouse to each and every sub-panel or control?

Thanks

+1  A: 

This is Windows' behaviour - it works as you expect under GTK. Personally, I'd leave your app as it is, for consistency with other Windows applications, and install WizMouse

Steven Sproat