slider for scrolling in GUI
7 views (last 30 days)
Hello! I have some problems with a slider that I am using for moving my objects on an interface.
This is what I am using:
set(handles.btn1,'Position',[pos1(1) pos1(2)-slider_value+1 pos1(3) pos1(4)]);
set(handles.btn2,'Position',[pos2(1) pos2(2)-slider_value+1 pos2(3) pos2(4)]);
set(handles.edittxt,'Position',[pos3(1) pos3(2)-slider_value+1 pos3(3) pos3(4)]);
At this point I am blocked because I really don't know how to move the scroll bar up and down. I don't know how to make conditions... Please help!!!
Walter Roberson on 12 Sep 2011
You would put code such as that in the callback for a slider.
I do not recommend that code. As noted in response to your earlier question, you should instead insert your elements in a uipanel and then set() the Position of the panel in your scroll callback: that will have the effect of moving everything contained within the uipanel all as a group.
If you want to position a slider to a particular location, you set() the value property of the slider.