Using a main GUI window to open new ones

3 vues (au cours des 30 derniers jours)
Mahbube
Mahbube le 21 Déc 2014
Modifié(e) : Joseph Cheng le 22 Déc 2014
I wrote a .fig file's name into button's callback funtion. When I click a button, a new GUI is opening and it's being 2 windows , when I click another button, another GUI is opening , and it's being 3 windows on the screen. But I don't want multiple windows on the screen. I want to use one main window and open my GUIs' on that main window. How can I do that.(By the way I'm creating my GUIs'with GUIDE not with code)
Thanks in advance.

Réponses (2)

Geoff Hayes
Geoff Hayes le 21 Déc 2014
Mahbube - if you are launching a second GUI from the first, via a pushbutton callback in the first GUI, then just close the first one. Try something like
function pushbutton1_Callback(hObject, eventdata, handles)
% launch your other GUI
% close the current GUI
close(handles.figure1);
The above assumes that the figure object of the first GUI is named/tagged as figure1. You can also close it by using/calling the name of the GUI, but the other way makes it clear exactly which figure/GUI that you are closing.
Try the above and see what happens!
  2 commentaires
Mahbube
Mahbube le 21 Déc 2014
I think I'm gonna use this, but it's still not the style that I'm looking for.
Thank you for your answer.
Geoff Hayes
Geoff Hayes le 22 Déc 2014
What was the style that you were looking for?

Connectez-vous pour commenter.


Joseph Cheng
Joseph Cheng le 22 Déc 2014
Modifié(e) : Joseph Cheng le 22 Déc 2014
What you could do is work with panels. i attached an example. I didn't have much time to comment it fully but it boils down to creating your different GUIs in panels and then shuffling them around depending on the button pressed.
  1. During opening function record position of all the panels
  2. save which one is the active panel
  3. limit the view to just the panel
  4. depending on which button was pressed swap the positions of the active panel with the desired.

Catégories

En savoir plus sur MATLAB 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