Filter löschen
Filter löschen

Popup selection dictated by button selection

2 Ansichten (letzte 30 Tage)
Jay
Jay am 11 Mär. 2016
Kommentiert: Image Analyst am 12 Mär. 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.

Akzeptierte Antwort

Image Analyst
Image Analyst am 11 Mär. 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 Kommentare
Jay
Jay am 12 Mär. 2016
Bearbeitet: Jay am 12 Mär. 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 am 12 Mär. 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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by