How to change the GUI content when selecting different menu buttons?

12 views (last 30 days)
Hi all,
Using GUIDE, I am developing a GUI which controls 3 different aspects of analysis work: input data, presentations and analysis.
I want to have three menu buttons for each of these (I know how to add menu buttons to a GUI). I want that each time a menu button is selected all the content of the main GUI figure - all the controls that the user see - will change. Much like the behavior of apps on a smartphone.
I know that I can create some buttons on the main GUI that, when being pushed, will open another GUI which will do the job. However, I want the more 'sexy' way of having to work with only one GUI.
Is there a way to do it?
Thanks, Alon
  2 Comments
Romano Geerling
Romano Geerling on 15 Nov 2016
To give a simple answer, yes you can.
However creating a GUI like this requires you to put all the controls into a uipanel and set the visibility to on and off when the user selects something from the menu. Does the menu only contains 3 options, then it might not be such a big issue.
If you create much more options the code is maybe harder to read and maintain and the performance might go down. Although you set the visibility of the uipanel to off all the code will still be executed by MATLAB.
Alon Rozen
Alon Rozen on 16 Nov 2016
Thanks Romano,
It turns that it works :) See my comment to Adam - there is no trouble to maintain or activate the code - as he suggested.

Sign in to comment.

Accepted Answer

Adam
Adam on 15 Nov 2016
You can do this programmatically quite easily. You can also do it in GUIDE with a little bit of programmatic addition, it is just a bit messy.
Basically you would need to put 3 panels on top of each other (using the object browser or 'send to back' option on the top panel) in GUIDE, with the functionality of each of your different GUIs in.
Then it is just a matter of making the other panels invisible and the one you want visible in response to the menu changing.
  1 Comment
Alon Rozen
Alon Rozen on 16 Nov 2016
Thanks a lot Adam :)
It works like magic and looks very 'sexy'. Indeed like a smartphone app.
Thanks again,
Alon

Sign in to comment.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps 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!