How can I make components (eg label or list box) visible, depending on the input of an edit field (numeric)?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Shanice Steinecke
am 25 Aug. 2021
Kommentiert: Shanice Steinecke
am 27 Aug. 2021
Hi guys! I'm new to MATLAB AppDesigner and I need your help! I created a numeric edit field, a label and a list box (label and list box are invisible at first). If the user enters '1' the label and the list box should appear. If the user enters another number both should stay invisible. The problem is, that they always stay invisible, no matter what the user enters. Here's my code, which doesn't work. Can somebody please help me? Thanks!
function EditFieldValueChanged(app, event)
value = app.EditField.Value;
if value == 1
app.Label.HandleVisibility = 'on';
app.ListBox.HandleVisibility = 'on';
else
app.Label.HandleVisibility = 'off';
app.ListBox.HandleVisibility = 'off';
end
end
0 Kommentare
Akzeptierte Antwort
Mario Malic
am 25 Aug. 2021
Hello,
Property Visible changes the visibility of the object.
app.Label.Visible = 'on';
app.ListBox.Visible = 'on';
Property HandleVisibility allows the object handle to be found or not by findall (or others) function.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!