Popup selection dictated by button selection

2 vues (au cours des 30 derniers jours)
Jay
Jay le 11 Mar 2016
Commenté : Image Analyst le 12 Mar 2016
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.

Réponse acceptée

Image Analyst
Image Analyst le 11 Mar 2016
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 commentaires
Jay
Jay le 12 Mar 2016
Modifié(e) : Jay le 12 Mar 2016
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 le 12 Mar 2016
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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Environment and Settings dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by