how to clear all selected listbox items
Mostrar comentarios más antiguos
i have a list box containing 20 items if i have selected 10 items now if i push button all selected list box needs to cleared
setting valuue property to [] makes listbox dissappear
Respuesta aceptada
Más respuestas (3)
Josh Kahn
el 29 de Mayo de 2025
If you receive this error:
Error using matlab.ui.control.internal.model.ExactlyOneSelectionStrategy/validateValuePresentInItemsData (line 238)
'Value' must be an element defined in the 'ItemsData' property.
then try using an empty cell array instead:
listBox.Value = {}
Jan
el 26 de Oct. de 2012
0 votos
Is the disappearing accompanied by a warning message? Please post the corresponding code, because a minimal example, which reproduces your problem, will clear, what you are actually doing. A textual descritpion usually does not contain the bug, which causes the troubles.
In other words: The actual question is: Why does setting Value to [] make the listbox invisible? This is not the expected behavior.
Azzi Abdelmalek
el 26 de Oct. de 2012
set(handles.yourlistbox,'enabled','off')
2 comentarios
Lockywolf
el 15 de Abr. de 2016
An uicontrol has no "enabled" property.
Image Analyst
el 15 de Abr. de 2016
What type of control are you referring to? Listboxes, buttons, checkboxes, radio buttons, edit fields, etc. all most certainly do have an enable property (though setting it to off will not deselect highlighted items in a listbox).
Categorías
Más información sobre Interactive Control and Callbacks en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!