Change positions of specific compoent based on conditions

1 次查看(过去 30 天)
Hey Guys,
So I want change the position of component such as list box and edit text. I already know how to change the positions but I want to change it based on conditions like if a certain item is selected from a different list box then it will go up y units and then it could go up another y units when an item is selected from another list box. But not allowing each selection from each list box to interfere with each other.
Since I am using GUIDE.... I am think of setting up like
if (conditions met)
set(handles.listbox,'Position',[(current) (current + y) (current) (current)]);
elseif (opposite conditions met)
set(handles.listbox,'Position',[(prev/origin) (prev/origin) (prev/origin) (prev/origin)]);
some where else in the code for a different list box
if (conditions met)
set(handles.listbox,'Position',[(current) (current + y) (current) (current)]);
elseif (opposite conditions met)
set(handles.listbox,'Position',[(prev/origin) (prev/origin) (prev/origin) (prev/origin)]);
%prev - previous value
%origin - original value
%current - current value
Now the only problem is I do not know how to set these numbers to be as dynamics as I want it to be.

采纳的回答

Sara
Sara 2014-12-23
Use the handles variable to carry around your values. In the opening function, do:
handles.origin = .....
handles.prev = handles.origin
Then, every time you change position, you'll have to set:
handles.current = ...
handles.prev = handles.current

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 General Applications 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by