The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Mouse scroll wheel for uicontrol slider
Replies: 1   Last Post: Jan 25, 2013 8:24 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Doug Schwarz

Posts: 1,412
Registered: 12/7/04
Re: Mouse scroll wheel for uicontrol slider
Posted: Jan 25, 2013 8:24 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

In article <kdulag$b1i$>,
"Boris " <> wrote:

> Hi all,
> I have recently begun using MATLAB 2010b and have a question about using the
> mouse scroll wheel in guis.
> I am working on a gui that has within it a uipanel with a 'slider' type
> uicontrol which scrolls through a number of axes. Everything is working
> properly, however I would like the slider to be able to be controlled by the
> scroll wheel on the mouse.
> I searched extensively for functions that could implement this, but all I
> found was the WindowsScrollWheelFcn, which is for figure type objects, not
> uicontrol types. I do not think that the function would work for uicontrol
> sliders, but perhaps it does?
> If anyone knows how to get the mouse scroll wheel to work for uicontrol
> sliders, I would really appreciate being pointed in the right direction. This
> is a relatively small part of the whole gui so I do not think it would be
> worth it for me to rewrite everything into a figure just to get the scroll
> wheel working, but I would be open to hearing such suggestions.
> Thanks for the help,
> Boris


The WindowsScrollWheelFcn for the figure is the right thing to use. If
you want the scroll wheel to "operate" multiple sliders, you'd have to
have a way to select which slider to "operate." You could either use
the last slider touched or perhaps use the slider closest to the current
pointer position. In any case, just program the scroll wheel function
to run the same (or similar) function as the slider. It won't be
connected to the slider, it'll just do the same thing. You can have it
update the slider, too, if you want by setting the slider value.

Doug Schwarz
Make obvious changes to get real email address.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.