How can I disable all of the objects in a "uibuttongroup" or "uipanel" at the same time?

조회 수: 4 (최근 30일)
I would like to disable all of the objects located inside one of the container objects (uibuttongroup and uipanel). Is there a property of the container that does this?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2021년 12월 10일
편집: MathWorks Support Team 2025년 3월 3일
As of R2020b onwards, both "uibuttongroup" and "uipanel" components support the Enable property when they are parented to a "uifigure". Refer to the ButtonGroup documentation to learn more about this. 
For releases before R2020b:
The container objects do not have a property that can disable all of its children. However, you can obtain the container's children, and then modify their Enable properties with a single command:
% Here 'c' is the handle to a container object children = get(c,'Children'); set(children,'Enable','inactive');
 
  댓글 수: 1
Eric Sargent
Eric Sargent 2020년 12월 9일
편집: MathWorks Support Team 2025년 6월 30일
As of R2020b ButtonGroup and Panel both support Enable when the button group or panel is parented to a uifigure.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Eric Sargent
Eric Sargent 2020년 12월 9일
편집: MathWorks Support Team 2024년 12월 6일
As of R2020b ButtonGroup and Panel both support Enable when the button group or panel is parented to a uifigure.

Wagih Abu Rowin
Wagih Abu Rowin 2020년 10월 25일
For Matlab App Designer 2018 and up you should use 'Enable','off' as:
% Here app.UIFigure is the main handel or container object
children = get(app.UIFigure,'Children');
set(children(isprop(children,'Enable')),'Enable','off')

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by