Programmatically select value in a list box

13 visualizaciones (últimos 30 días)
Marcus
Marcus el 19 de Dic. de 2025 a las 12:02
Editada: Fangjun Jiang el 19 de Dic. de 2025 a las 13:59
I want to rearrange elements in a list box of a block mask in a
function moveDown(maskObj, controlName)
The rearrangement basically works as desired, however I am struggling with updating the selection after rearrangement.
When using
controlHandle = maskObj.getDialogControl(controlName);
selectedItems = controlHandle.getSelectedItems;
then rearranging the entries with
controlHandle.TypeOptions = rearrangedItems;
setting the same set of selected entries as before with
controlHandle.setSelectedItems = selectedItems;
fails with
% Error: Assignment not supported becuase the result of method
% 'setSelectedItems' is a temporary value
How can I update the selected items in the list box properly?
Thanks for your support.

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 19 de Dic. de 2025 a las 13:59
Editada: Fangjun Jiang el 19 de Dic. de 2025 a las 13:59
should be
controlHandle.setSelectedItems(selectedItems)

Categorías

Más información sobre Create Block Masks en Help Center y File Exchange.

Productos


Versión

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by