DROP DOWN app designer

7 ビュー (過去 30 日間)
Rida BOUMEDIANE
Rida BOUMEDIANE 2020 年 5 月 19 日
回答済み: Aniket 約12時間 前
I want to make 3 drop down related between them, when i choose a name from the first it gives me to chose a special names from the second dropdown and then to chose anaother name from the third dropdown
  3 件のコメント
Rida BOUMEDIANE
Rida BOUMEDIANE 2020 年 5 月 20 日
Thanks for the answer, When o will click on the first choice the dropdown2 will give me only the needed items depending on the first drop down, and the same thing for the third dropdown it will depend on the second dropdown. Yes i m using app designer
Adam Danz
Adam Danz 2020 年 5 月 20 日
I understand that. See my questions above.

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

回答 (1 件)

Aniket
Aniket 約12時間 前
I understand you want to create interdependent dropdown menus in App Designer, where each selection dynamically determines the options in the next dropdown. This can be accomplished by using callback functions to populate and enable each subsequent dropdown based on the previous selection.
Kindly follow the steps below to achieve this functionality:
1. Initialise the dropdowns
2. Set the "Enable" property of ‘DropDown2’ and DropDown3 to "off". You may refer to following link to know more about "Enable" property of DropDown UI component:
3. Populate the first dropdown with options.
The startup function should look like this:
function startupFcn(app)
app.Dropdown1.Items = fieldnames(data);
app.Dropdown2.Enable = 'off';
app.Dropdown3.Enable = 'off';
end
4. Implement a callback function for ‘DropDown1’ that populates options in ‘DropDown2’ based on selection in ‘DropDown1’. Also it should set "Enable" to "on" state for ‘DropDown2’.
Callback for ‘Dropdown1’:
function Dropdown1ValueChanged(app, event)
selectedOption = app.Dropdown1.Value;
app.Dropdown2.Items = data.(selectedOption).SubOptions;
app.Dropdown2.Enable = 'on';
app.Dropdown3.Enable = 'off';
end
5. Follow similar steps for ‘DropDown3’ .
You can learn more about callback functions in App Designer using this documentation:
I hope this helps you!

カテゴリ

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