How can I set my list box to have no default selection in MATLAB?

10 visualizaciones (últimos 30 días)
I would like to set my list box such that none of its items are highlighted upon creation.
I tried using the following code to set the "Value" property of the list box to an empty matrix. However, instead of seeing the desired result, the list box disappears.
item_list = {'L1';'L2';'L3';'L4';'L5'};
h = uicontrol('style','list','Position',[40 40 80 70],...
'string',item_list, 'Value', []);

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 27 de Jun. de 2009
You can set your list box to have no selection by setting the 'Value' property to an empty matrix and setting the 'Max' and 'Min' properties to satisfy the following condition:
Max - Min > 1
The above condition enables multiple selection.
For example:
item_list = {'L1';'L2';'L3';'L4';'L5'};
h = uicontrol('style','list','max',2,...
'min',0,'Position',[40 40 80 70],...
'string',item_list, 'Value', []);

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by