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 Kommentar

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

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 14 Mär. 2012

3 Stimmen

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 Kommentare

Avi Pal
Avi Pal am 14 Mär. 2012
thank you for the answer.
but please tell how to select a particular panel among no. of panels ?
Walter Roberson
Walter Roberson am 14 Mär. 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 am 14 Mär. 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 am 14 Mär. 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 am 14 Mär. 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 am 3 Sep. 2017
enable is not property of panel. after enable of if convert into on than this is not working
Walter Roberson
Walter Roberson am 3 Sep. 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 am 3 Sep. 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 am 3 Sep. 2017
Bearbeitet: Image Analyst am 3 Sep. 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 am 3 Sep. 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 am 4 Sep. 2017
matlab15a
praveen chandaliya
praveen chandaliya am 4 Sep. 2017
i am not getting error message
Image Analyst
Image Analyst am 4 Sep. 2017
OK, good. So I assume it's working now.
Walter Roberson
Walter Roberson am 4 Sep. 2017
Please post a small example that demonstrates the problem.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Eric Sargent
Eric Sargent am 9 Dez. 2020

0 Stimmen

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

Kategorien

Mehr zu App Building finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by