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

2 vues (au cours des 30 derniers jours)
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?

Réponse acceptée

Jessica Angulo Capel
Jessica Angulo Capel le 31 Juil 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 commentaire
Marcus Adkins
Marcus Adkins le 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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by