Scroll wheel motion and sliders

We got a bug report that the sliders in our application were working “backwards” when actuated with the scroll wheel.

On a vertical slider, scrolling the wheel “down” (towards yourself over the top) always moves the slider down on the screen. Using wx.SL_INVERSE style on the widget puts the small value on the bottom and all is well with the world.

With horizontal sliders though, scrolling down always moves the slider to the right. If you use ws.SL_INVERSE in this case, the small value on the right is just too weirdly counter intuitive, so I’m not going there. Is there some way to intercept the scroll events and invert them for horizontal sliders so “down” goes left? (We found some horizontal sliders in PowerPoint and they behave this way, so even Microsoft thinks this is correct.)

Thanks,
Eric

Obligatory test script:

#!/usr/bin/env python

import wx

class SliderFrame(wx.Frame):

def __init__(self):

    wx.Frame.__init__(self, None, -1, "Slider Example", size=(600, 350))

    panel = wx.Panel(self)

    s1 = wx.Slider(panel, pos=(  0, 0), size=(300,300),style=wx.SL_HORIZONTAL | wx.SL_LABELS)

    s2 = wx.Slider(panel, pos=(300, 0), size=(300,300),style=wx.SL_VERTICAL   | wx.SL_LABELS | wx.SL_INVERSE)

    s1.Bind(wx.EVT_SCROLL_CHANGED, self.OnScroll)

    s2.Bind(wx.EVT_SCROLL_CHANGED, self.OnScroll)

def OnScroll(self, event):

    print(event.EventObject.GetValue())

if name == “main”:

app = wx.App()

frame = SliderFrame()

frame.Show()

app.MainLoop()