Clear Filters
Clear Filters

How to open one GUI from Another using a Pop-up menu

1 view (last 30 days)
So I have a main GUI that I want to open up sub-GUIs.
On the main GUI I have 2 push buttons (Car and Boat) next to each other. Beneath them I have a Pop-up menu (one for each push button).
What I desire is once the user selects either the Car or Boat push buttons the relative Pop-up menu will activate with the different sub-GUIs (and their file paths).
The sub-GUI list will be the type of Car or Boat, which once selected the sub-GUI will open and the user has to put in the different data for depreciation, insurance costings etc.
I don't want to have to "poll" each sub-GUI if at all possible.

Accepted Answer

Image Analyst
Image Analyst on 5 Mar 2016
Why do you want the second GUI name in a popup menu if you want to active it immediately upon pushing the button? Anyway, you simple set the popup index in the callbacks. Let's say the string property for the popup was set in GUIDE with the strings 'CarGUI.m' and 'BoatGUI.m'. So then in the car button callback
% Set popup to index 1
set(handles.popup, 'Value', 1);
% Now launch the CarGUI function
CarGUI
And in the callback for the boat, you'd do
% Set popup to index 2
set(handles.popup, 'Value', 2);
% Now launch the BoatGUI function
BoatGUI
  5 Comments
Image Analyst
Image Analyst on 6 Mar 2016
The commands inside the "if" blocks will run the subGuis. If you don't expect any results to be returned and simply want to launch an m-file called "FordMustang.m", then simply have
FordMustang
That will launch FordMustang.m and it should appear as the top most window. If you want it maximized in the Windows OS, in FordMustang's startup code, call MaximizeFigureWindow - Yair's function which I attach.

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!