MATLAB Answers


Getting GUI Slider updates while dragging

Asked by Norton Allen on 23 Oct 2012
Latest activity Commented on by Stephen Cobeldick on 24 Jan 2016

Is there a straightforward method to get updates on a slider's position while it is being dragged? The standard callback gets called only after the drag is complete and the button has been released.

I'm thinking of using the ButtonDownFcn to start a polling loop checking the slider's value. (Then how do I detect mouse up?)


Why don't you describe in detail what you are hoping to accomplish with this information and we will see if there is a optimal way to get there?

ButtonDownFcn is disabled over an enabled uicontrol

Matt, what I'm trying to do is get a slider where the app updates while the slider is moving, for example the way a browser updates while you are moving the scroll bar.

Sean, I did discover that ButtonDownFcn is not the answer pretty quickly too!

Sign in to comment.

1 Answer

Answer by Sean de Wolski
on 23 Oct 2012
 Accepted Answer

This can be done easily with addlistener

h = uicontrol('style','slider','callback',@(src,evt)disp(get(src,'value')));


Yes, this sounds like what I am looking for. Thanks!

Hi How to get the slider update value into variable?

Sign in to comment.