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

8 Ansichten (letzte 30 Tage)
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?

Akzeptierte Antwort

Allen
Allen am 1 Mär. 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 Kommentare
Allen
Allen am 1 Mär. 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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by