How to make an interactive drop down in App Designer?

16 ビュー (過去 30 日間)
Raees Mohammed
Raees Mohammed 2018 年 1 月 16 日
I want to make an application for App Designer that uses a drop down button, a button group, and a pushbutton to display different images on a UIAxes. The user should be able to select a drop down value, then based on that value, be allowed to choose only from a selection of the radio buttons available in the button group. Then click the push button and a certain image will display.
For example:
UIdropdown has the items: 'A', 'B', 'C'
UIButtongroup has the uiradiobuttons: app.Red, app.Blue, app.Green, app.Yellow
If the user selects the item 'A', then I want the uiradiobuttons app.Yellow and app.Blue to have the 'Enable' property set to 'off', such that the user will only be able to select either uiradiobuttons app.Red or app.Green.
So I how to disable the uiradiobutton if I have a callback on pushbutton:
eg./ app.Blue.Enable = 'off'; app.Yellow.Enable = 'off';
My problem is I do not know how to apply this for a drop down component based on the items the user selects. I tried to write a callback on the drop down component using conditionals (if...else) but for every other item after the 1st item in the drop down component, I get this error:
Error using uiradiobutton (line 58) There is no on property on the RadioButton class.
It also only works after I click the pushbutton.

採用された回答

Elias Gule
Elias Gule 2018 年 1 月 16 日
Add a 'DropDownValueChanged' callback to your uidropdown;
  3 件のコメント
Raees Mohammed
Raees Mohammed 2018 年 1 月 16 日
Thanks, I got it to work.
If the dropdown was named Letter and the RadioButton group was named Colour.
L = app.Letter.Value;
if strcmp(L,'A')
%code for letter A
app.Red.Enable = 'on';
app.Blue.Enable = 'off';
app.Green.Enable = 'on';
app.Yellow.Enable = 'off';
elseif strcmp(L,'B')
%code for letter B
elseif strcmp(L,'C')
%code for letter C
else
%Default
app.Red.Enable = 'on';
app.Blue.Enable = 'on';
app.Green.Enable = 'on';
app.Yellow.Enable = 'on';
end
Francheska Payongayong
Francheska Payongayong 2018 年 5 月 21 日
Hi, I'm currently working on an application that needs an interactive drop down button; and your code really helped. However, I just want to know, is it possible to create an interaction between two drop down buttons?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by