Effacer les filtres
Effacer les filtres

Configure GUI listbox to initially have no selections

2 vues (au cours des 30 derniers jours)
Jared
Jared le 23 Jan 2013
When I populate a listbox with a list of filenames, the first string in the list is always highlighted. I want it so nothing is selected upon initial loading.
I use:
set(handles.files, 'String', handles.list_names,'Value',0)
handles.files is the listbox, and handles.list_names are the strings that will be put in the listbox. I added the 'Value',0 part, but then I get the error:
Warning: multi-selection listbox control requires that Value be an integer within String range Control will not be rendered until all of its parameter values are valid
Any ideas?

Réponse acceptée

Walter Roberson
Walter Roberson le 23 Jan 2013
I do not see any mechanism for this.
When I need to do something like this, I usually add a header line such as 'Choose File' as the first string (the one that gets highlighted), and then I program my functions to know that value 1 means nothing selected.
  1 commentaire
Jared
Jared le 23 Jan 2013
Bummer, not a huge deal, just trying to clean things up a bit.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by