How to disable a panel in GUIDE ?

i have a panel with a no. of push buttons and other test fields, and i want to disable them till a radio button is selected; So, how can disable an entire panel without going for each component and disable them separately ??
I am using Matlab 2011a.

1 comentario

Eric Sargent
Eric Sargent el 9 de Dic. de 2020
As of R2020b ButtonGroup and Panel both support Enable when the button group or panel is parented to a uifigure.

Iniciar sesión para comentar.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 14 de Mzo. de 2012

3 votos

You could set() the entire uipanel to have Visible 'off'
But if you want the panel to be still visible, then
set(findall(PanelHandle, '-property', 'enable'), 'enable', 'off')

15 comentarios

Avi Pal
Avi Pal el 14 de Mzo. de 2012
thank you for the answer.
but please tell how to select a particular panel among no. of panels ?
Walter Roberson
Walter Roberson el 14 de Mzo. de 2012
PanelHandle should be the handle of the panel you want to disable.
How are you distinguishing them in your code?
Avi Pal
Avi Pal el 14 de Mzo. de 2012
now its working; i used the following
set(findall(handles.PanelHandle, '-property', 'enable'), 'enable', 'off')
since I was executing the line from the opening function of the figure.
Thanks a lot for your help ...
Avi Pal
Avi Pal el 14 de Mzo. de 2012
just out of curiosity i am asking,
i couldn't find the enable property of a panel from the property inspector, but in the above line of code we are able to access it .. can u provide some explanation ?
Walter Roberson
Walter Roberson el 14 de Mzo. de 2012
There is no enable property of a uipanel.
findall() looks at all the children (recursively) of the given handle (the panel), and in the form given looks only for the children which have an 'enable' property; it returns that list of handles, and the set() sets the enable property of those handles to 'off'
praveen chandaliya
praveen chandaliya el 3 de Sept. de 2017
enable is not property of panel. after enable of if convert into on than this is not working
Walter Roberson
Walter Roberson el 3 de Sept. de 2017
praveen chandaliya:
This code never tries to set the enable property of a panel. The findall() looks inside the panel to findall all contained graphics object that have an "enable" property, and it sets their "enable" status to 'off'
praveen chandaliya
praveen chandaliya el 3 de Sept. de 2017
Walter thank for clear my doubt. but i want to know after "enable" status go "off". if am required to "on" status of panel gui object than how to "on" its
praveen chandaliya
praveen chandaliya el 3 de Sept. de 2017
Editada: Image Analyst el 3 de Sept. de 2017
set(findall(handles.uipanel9, '-property', 'Visible'), 'Visible', 'on')
this code not working
set(findall(PanelHandle, '-property', 'enable'), 'enable', 'on')
not working either
Walter Roberson
Walter Roberson el 3 de Sept. de 2017
It works in my tests. Which MATLAB version are you using? Are you getting any error message?
Try
handles.uipanel9.Visible = 'on'; % Or 'off'
handles.uipanel9.Enable = 'on'; % Or 'off'
praveen chandaliya
praveen chandaliya el 4 de Sept. de 2017
matlab15a
praveen chandaliya
praveen chandaliya el 4 de Sept. de 2017
i am not getting error message
Image Analyst
Image Analyst el 4 de Sept. de 2017
OK, good. So I assume it's working now.
Walter Roberson
Walter Roberson el 4 de Sept. de 2017
Please post a small example that demonstrates the problem.

Iniciar sesión para comentar.

Más respuestas (1)

Eric Sargent
Eric Sargent el 9 de Dic. de 2020

0 votos

As of R2020b ButtonGroup and Panel both support Enable when the button group or panel is parented to a uifigure.

Categorías

Más información sobre App Building en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 14 de Mzo. de 2012

Respondida:

el 9 de Dic. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by