フィルターのクリア

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

1 回表示 (過去 30 日間)
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?

採用された回答

Jessica Angulo Capel
Jessica Angulo Capel 2020 年 7 月 31 日
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 件のコメント
Marcus Adkins
Marcus Adkins 2023 年 9 月 1 日
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.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by