App Designer DropDown Menu cannot select the first item

10 ビュー (過去 30 日間)
Maura Monville
Maura Monville 2022 年 5 月 18 日
I have inserted a DropDown Menu (TrialsListDropDown) in my GUI that I am creating with the App designer.
It is initialized in the startupFCN function as follows:
app.TrialsListDropDown.Items = cellstr(strings(5,1));
It is populated when the user selects the path of the file containing the strings to display as follows:
app.TrialsListDropDown.Value = "";
app.TrialsListDropDown.Items = app.CellTrialNames;
app.TrialsListDropDown.ItemsData = app.CellTrialNames;
The strings are correctly displayed in the DropDown Menu.
The selection of a DropDown item is caried out through a callback as follows:
% Value changed function: TrialsListDropDown
function TrialsListDropDownValueChanged(app, event)
value = app.TrialsListDropDown.Value;
app.SelectedTrial = app.TrialsListDropDown.Value;
disp(app.SelectedTrial) % DEBUG PURPOSE
end
So far the above callback contains just the code to extract the selected item and display it.
My problem is that the first DropMenu item cannot be selected. I have to select one of the other items and then go back to the first one.
I understand the callback is only triggered upon Value changed. I deduce the first listed item is by default the selected item.
How can I change this behaviour so that the user can select also the first item right away after the DropDown Menu is populated?
Thank you so much.
Maura (maura.monville@nhs.net)

回答 (0 件)

カテゴリ

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

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by