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

7 views (last 30 days)
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?

Accepted Answer

Allen
Allen on 1 Mar 2021
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 Comments
Allen
Allen on 1 Mar 2021
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.

Sign in to comment.

More Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!