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

9 Ansichten (letzte 30 Tage)
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', []);

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 27 Jun. 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', []);

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by