Popup selection dictated by button selection

1 次查看(过去 30 天)
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