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.
No item can be selected when having a single element in a list box (App Designer)
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Jessica Angulo Capel
el 30 de Jul. de 2020
Comentada: Marcus Adkins
el 1 de Sept. de 2023
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?
0 comentarios
Respuesta aceptada
Jessica Angulo Capel
el 31 de Jul. de 2020
1 comentario
Marcus Adkins
el 1 de Sept. de 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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!