App Designer DropDown Menu cannot select the first item

12 views (last 30 days)
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)

Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!