How can I hide the App Designer Slider Control's built in label programmatically?

조회 수: 19 (최근 30일)
I have an App with a series of Slider Controls. One of these controls is made visible or not visible by the status of a checkbox control as follows:
function ctrl_check_chkValueChanged(app, event)
sldr = app.ctrl_sldrOfIntrest;
if app.ctrl_check.Value
sldr.Visible = 'on';
else
sldr.Visible = 'off';
end
end
However, even when 'Visible' is set to 'off', the label for the control remains visible. I would like to make the label dissapear as well. Thoughts?

채택된 답변

Allen
Allen 2021년 3월 1일
In App Designer the label handles are created in conjunction with, but separately from the main object. The handles for the labels are not shown in the Component Browser panel by default, but you can right-click on any of the items in the that panel to bring up an incontext menu that allows you to show/include those label handles in the browser.
Then it becomes are simple as you are currently doing to change the visibility for the slider.
function ctrl_check_chkValueChanged(app, event)
sldr = app.ctrl_sldrOfIntrest;
if app.ctrl_check.Value
sldr.Visible = 'on';
app.("your label handle").Visible = "on";
else
sldr.Visible = 'off';
app.("your label handle").Visible = "off";
end
end
  댓글 수: 2
Allen
Allen 2021년 3월 1일
You are welcome. Sometimes, it is nice to come across a problem with a simple solution. I know about the hidden label handles and it still bites me from time to time.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by