Getting GUI Slider updates while dragging
显示 更早的评论
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?)
3 个评论
Matt Fig
2012-10-23
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?
Sean de Wolski
2012-10-23
ButtonDownFcn is disabled over an enabled uicontrol
Norton Allen
2012-10-24
编辑:Norton Allen
2012-10-24
采纳的回答
更多回答(1 个)
AG
2019-2-20
The following worked for me. I get a 'live' scroll-bar update by calling this within another function:
slider_value = get(gcf.Children(j), 'Value');
...where j is the value of the UIcontrol corresponding to the scroll. You can find out which UIControl it is in the figure by putting a break in the code and using:
gcf.Children
This could also be ascertained in run-time using:
for j = 1:length(gcf.Children)
get(gcf.Children(j), 'Tag')
end
which will return a char array with the Tag of each of the children which could then be compared using strcmp(), for example. I've done this using a GUI created with GUIDE.
类别
在 帮助中心 和 File Exchange 中查找有关 App Building 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!