Borrar filtros
Borrar filtros

How can I select multiple items from a GUI listbox?

82 visualizaciones (últimos 30 días)
How can I select multiple items from a GUI listbox?

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 17 de Mayo de 2023
Editada: MathWorks Support Team el 17 de Mayo de 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);

Más respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by