Clear Filters
Clear Filters

Configure GUI listbox to initially have no selections

2 views (last 30 days)
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?

Accepted Answer

Walter Roberson
Walter Roberson on 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.

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!