MATLAB Answers

Enable/disable dropdowns when checkbox checked/unchecked in MATLAB2019A app designer

47 views (last 30 days)
Rohit Deshmukh
Rohit Deshmukh on 6 Nov 2019
Answered: Kojiro Saito on 6 Nov 2019
Capture.PNG
I want to disable the given dropdown if the checkbox is selected and enable it once checkbox is unchecked.
How should be the code?

  0 Comments

Sign in to comment.

Answers (1)

Kojiro Saito
Kojiro Saito on 6 Nov 2019
First, add ValueChangedFcn callback from app.CheckBox.
2019116204136.jpg
Then, define CheckBoxValueChanged function as the follows.s
% Value changed function: CheckBox
function CheckBoxValueChanged(app, event)
value = app.CheckBox.Value;
if value == true
% If checkbox is checked, make dropdown disable
app.DropDown.Enable = false;
else
% If checkbox is unchcked, make dropdown enable
app.DropDown.Enable = true;
end
end
Here is a screenshot.
2019116204446.jpg

  0 Comments

Sign in to comment.

Sign in to answer this question.

Products


Release

R2019a

Translated by