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 件のコメント

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

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2012 年 3 月 14 日

3 投票

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 件のコメント

Avi Pal
Avi Pal 2012 年 3 月 14 日
thank you for the answer.
but please tell how to select a particular panel among no. of panels ?
Walter Roberson
Walter Roberson 2012 年 3 月 14 日
PanelHandle should be the handle of the panel you want to disable.
How are you distinguishing them in your code?
Avi Pal
Avi Pal 2012 年 3 月 14 日
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 2012 年 3 月 14 日
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 2012 年 3 月 14 日
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 2017 年 9 月 3 日
enable is not property of panel. after enable of if convert into on than this is not working
Walter Roberson
Walter Roberson 2017 年 9 月 3 日
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 2017 年 9 月 3 日
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 2017 年 9 月 3 日
編集済み: Image Analyst 2017 年 9 月 3 日
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 2017 年 9 月 3 日
It works in my tests. Which MATLAB version are you using? Are you getting any error message?
Image Analyst
Image Analyst 2017 年 9 月 3 日
Try
handles.uipanel9.Visible = 'on'; % Or 'off'
handles.uipanel9.Enable = 'on'; % Or 'off'
praveen chandaliya
praveen chandaliya 2017 年 9 月 4 日
matlab15a
praveen chandaliya
praveen chandaliya 2017 年 9 月 4 日
i am not getting error message
Image Analyst
Image Analyst 2017 年 9 月 4 日
OK, good. So I assume it's working now.
Walter Roberson
Walter Roberson 2017 年 9 月 4 日
Please post a small example that demonstrates the problem.

サインインしてコメントする。

その他の回答 (1 件)

Eric Sargent
Eric Sargent 2020 年 12 月 9 日

0 投票

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

カテゴリ

ヘルプ センター および File ExchangeUpdate figure-Based Apps についてさらに検索

タグ

質問済み:

2012 年 3 月 14 日

回答済み:

2020 年 12 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by