How can I set my list box to have no default selection in MATLAB?
8 次查看(过去 30 天)
显示 更早的评论
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', []);
采纳的回答
MathWorks Support Team
2009-6-27
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', []);
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!