Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.
|
|
|
Re: Mouse scroll wheel for uicontrol slider
Posted:
Jan 25, 2013 8:24 PM
|
|
In article <kdulag$b1i$1@newscl01ah.mathworks.com>, "Boris " <bmateev@ymail.com> 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
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 dmschwarz&ieee,org Make obvious changes to get real email address.
|
|
|
|