Azzera filtri
Azzera filtri

How can I select multiple items from a GUI listbox?

82 visualizzazioni (ultimi 30 giorni)

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 17 Mag 2023
Modificato: MathWorks Support Team il 17 Mag 2023
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);

Più risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Tag

Non è stata ancora inserito alcun tag.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by