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

8 visualizaciones (últimos 30 días)
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?

Respuesta aceptada

Allen
Allen el 1 de Mzo. de 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 comentarios
Allen
Allen el 1 de Mzo. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by