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 CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by