Change positions of specific compoent based on conditions

1 visualizzazione (ultimi 30 giorni)
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.

Risposta accettata

Sara
Sara il 23 Dic 2014
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

Più risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by