필터 지우기
필터 지우기

how use two popup menu which are related together?

조회 수: 3 (최근 30일)
sama
sama 2015년 10월 9일
댓글: Walter Roberson 2017년 2월 17일
Hello. I am new at GUI and am confused at using two related pop menus. Suppose I have a popup menu(1) that shows 1,2,3,4. I would like to have another popup menu(2) which based on the popup menu(1) shows different values. For example if I select 1 for popup menu(1) then shows 5,6,7 for popup menu(2). Or if I select 2 for the first one, popup menu(2) shows different values. I know it is easy but I cannot figure it out. Thanks a lot in advance

답변 (2개)

YACINE POWER
YACINE POWER 2017년 2월 17일
Can anynone answer to this please ..?

Walter Roberson
Walter Roberson 2015년 10월 9일
The callback for the first popup would need to change the String property of the second popup to reflect the available choices.
  댓글 수: 2
sama
sama 2015년 10월 12일
Would you please explain more?
Walter Roberson
Walter Roberson 2017년 2월 17일
pop1_value = get(handles.popup1, 'Value');
if pop1_value == 1
set(handles.popup2, 'String', {'5', '6', '7'}, 'Value', 1);
elseif pop1_value == 2
set(handles.popup2, 'String', {'tall', 'dark', 'winsome', 'oxalic'}, 'Value', 3);
elseif pop1_value == 3
set(handles.popup2, 'String', '', 'Enable', 'off');
else
set(handles.popup2, 'String', {'Slide', 'Charlie Brown', 'slide!'}, 'Value', 1);
end

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Numeric Types에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by