How can I hide the App Designer Slider Control's built in label programmatically?
8 次查看(过去 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?
0 个评论
采纳的回答
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
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 Center 和 File 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!