Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
GUI question

Subject: GUI question

From: Brianne

Date: 23 Nov, 2010 22:42:05

Message: 1 of 4

I want to create a menu bar on my GUI figure, that says option 1 and option 2.
I then want the user to be able to click either option and the respected GUI displays on the figure. For example, if the user clicks option 1 then some editable boxes appears on the figure. If the user clicks option 2 then a editable table appears on the figure.

My question is how to I get the figure to clear if the user clicks option 1, first, then clicks options 2, second, and vice versa without losing the menu bar when the figure is cleared.

Subject: GUI question

From: John

Date: 23 Nov, 2010 23:09:04

Message: 2 of 4

"Brianne " <brianne.y.williams@aero.org> wrote in message <ichfvs$9du$1@fred.mathworks.com>...
> I want to create a menu bar on my GUI figure, that says option 1 and option 2.
> I then want the user to be able to click either option and the respected GUI displays on the figure. For example, if the user clicks option 1 then some editable boxes appears on the figure. If the user clicks option 2 then a editable table appears on the figure.
>
> My question is how to I get the figure to clear if the user clicks option 1, first, then clicks options 2, second, and vice versa without losing the menu bar when the figure is cleared.

When the first option is selected I would have a callback routine that sets the 'Visible' property of all the elements pertaining to the second option to 'off' and vice versa, hope that helps.

John

Subject: GUI question

From: Paulo

Date: 23 Nov, 2010 23:34:04

Message: 3 of 4

"John " <jrazzano@usc.edu> wrote in message <ichhig$kmd$1@fred.mathworks.com>...
> "Brianne " <brianne.y.williams@aero.org> wrote in message <ichfvs$9du$1@fred.mathworks.com>...
> > I want to create a menu bar on my GUI figure, that says option 1 and option 2.
> > I then want the user to be able to click either option and the respected GUI displays on the figure. For example, if the user clicks option 1 then some editable boxes appears on the figure. If the user clicks option 2 then a editable table appears on the figure.
> >
> > My question is how to I get the figure to clear if the user clicks option 1, first, then clicks options 2, second, and vice versa without losing the menu bar when the figure is cleared.
>
> When the first option is selected I would have a callback routine that sets the 'Visible' property of all the elements pertaining to the second option to 'off' and vice versa, hope that helps.
>
> John

John is right, here's a simple example:

- One simple GUI with two pushbuttons, OPTION1 and OPTION2
- One editbox (edit1) and one axe (axes1)
- Start with only the pushbuttons visible by adding this to the GUI initialization code

set(handles.edit1,'Visible','off');
set(handles.axes1,'Visible','off');

- The callback for the pushbutton OPTION 1 puts the editbox visible and the axes1 invisible

set(handles.edit1,'Visible','on');
set(handles.axes1,'Visible','off');

- The callback for the pushbutton OPTION 2 puts the editbox invisible and the axes1 visible

set(handles.edit1,'Visible','off');
set(handles.axes1,'Visible','on');

hope this helps

Subject: GUI question

From: ImageAnalyst

Date: 23 Nov, 2010 23:40:14

Message: 4 of 4

Why don't you try MAGIC:
http://www.mathworks.com/matlabcentral/fileexchange/24224
It has all that and more.

Description

This GUI will help the novice user get up to speed very quickly on
using GUI-based applications. Everything is laid out in a very simple
Step 1, Step 2, Step 3, etc. layout. It is a very good starting point
for a typical image analysis application. This application uses GUIDE
to do the user interface design, and has most of the basic controls
such as buttons, listboxes, checkboxes, radio buttons, scrollbars,
etc. It allows the user to select a folder of images, select one or
more images and display them, to select a series of options, and to
individually or batch process one or more images.
[snip]
etc......

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us