How can I select multiple items from a GUI listbox?
조회 수: 82 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2013년 6월 21일
편집: MathWorks Support Team
2023년 5월 17일
How can I select multiple items from a GUI listbox?
채택된 답변
MathWorks Support Team
2023년 5월 17일
편집: MathWorks Support Team
2023년 5월 17일
To select multiple items in a List box the Max and Min properties must be defined. If Max - Min > 1, then list boxes allow multiple item selection. If Max - Min <= 1, then list boxes do not allow multiple item selection. Please refer to the documentation page for Max and Min for the List box in the following link:
An example for creating a List box that allows multiple item selection is created with the commands below:
txt_cell_array = {'line1';'line2';'line3';'line4';'line5'};
h_list = uicontrol('style','list','max',10,...
'min',1,'Position',[20 20 80 60],...
'string',txt_cell_array);
Notice that the UICONTROL function creates the List box, as per its documentation page:
For a list of additional properties for the UICONTROL please refer to the following documentation page:
Note that if you currently have a List box available, to enable multiple item selection you need to set the Max and Min properties of this List box via its handle.
set(h_list,'Max',2,'Min',0);
The above command allows a maximum number of two selections in the List box with handle "h_list". To dissable multiple item selection on the List box, set the properties as follows:
set(h_list,'Max',1,'Min',0);
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!