Configure GUI listbox to initially have no selections

2 visualizaciones (últimos 30 días)
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?

Respuesta aceptada

Walter Roberson
Walter Roberson el 23 de En. de 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 comentario
Jared
Jared el 23 de En. de 2013
Bummer, not a huge deal, just trying to clean things up a bit.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by