Filter löschen
Filter löschen

No item can be selected when having a single element in a list box (App Designer)

1 Ansicht (letzte 30 Tage)
Hello,
I am doing a UI in app designer. It contains a list box in which one can add the items (file paths).
When the list box displays several items, it is possible to select one of them and the callback is the following:
app.SelectedVideo2 = app.VideoFilesListBox_2.Value;
This new variable is used afterwards for video preview.
However, when only one item in the listbox is displayed, it is not possible to select it and the variable app.SelectedVideo2 does not change.
How can I solve this problem?

Akzeptierte Antwort

Jessica Angulo Capel
Jessica Angulo Capel am 31 Jul. 2020
I found the problem. It seems the callback is only called when the value is changed (ValueChangedFcn callback). Therefore, given there is only one item, it can not "be changed" and the callback does not work.
  1 Kommentar
Marcus Adkins
Marcus Adkins am 1 Sep. 2023
That's the answer to your problem - but not a fix. I have code that populates other items in the GUI based on the listbox selection and if I only have one item, I'm stuck. The only workaround I can think of so far is to insert a 'dummy' first item and then have my code ignore that if selected. It's pretty ugly.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by