필터 지우기
필터 지우기

Popup selection dictated by button selection

조회 수: 2 (최근 30일)
Jay
Jay 2016년 3월 11일
댓글: Image Analyst 2016년 3월 12일
I have 2 push buttons on my GUI.
When I push pushbutton 1, I want popup menu 1 to show, similarly when I push pushbutton 2 I want popup menu 2 to show. During start up I don't want any popup menus to show, only the pushbuttons.
In other words I would like the pushbutton selection to determine the popup menus.

채택된 답변

Image Analyst
Image Analyst 2016년 3월 11일
Set the Visible property to both popups to false/off. Then in the callback for button 1, set the visibilities
handles.popup1.Visible = 'on'; % or 1 - not sure.
handles.popup2.Visible = 'off'; % or 0 - not sure.
In the callback for button 2, set the visibilities
handles.popup1.Visible = 'off'; % or 0 - not sure.
handles.popup2.Visible = 'on'; % or 1 - not sure.
If you have an old version and the OOP way of setting properties doesn't work, then use set():
set(handles.popup1, 'Visible', 'off');
  댓글 수: 2
Jay
Jay 2016년 3월 12일
편집: Jay 2016년 3월 12일
I just realised that in order to turn the visibility off I needed to change them in GUIDE and not in the function by coding.
MatLab 2013 requires the older code and wont allow OOP.
Thankyou for your help.
Image Analyst
Image Analyst 2016년 3월 12일
Actually, you can turn the visibility on or off either in GUIDE or in the m-file. They both will work.
If you want it to come up with a certain visibility, you can either do it in GUIDE (which is what I do), or you can do it in the OpeningFcn() function with the set() function like I showed.

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

추가 답변 (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