Change positions of specific compoent based on conditions

1 回表示 (過去 30 日間)
Tamfor Dulin
Tamfor Dulin 2014 年 12 月 22 日
コメント済み: Tamfor Dulin 2014 年 12 月 24 日
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
  2 件のコメント
Sara
Sara 2014 年 12 月 24 日
What do you mean by working with each other?
Tamfor Dulin
Tamfor Dulin 2014 年 12 月 24 日
Actually nevermind fix my problem. Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by