Programmatically select value in a list box
32 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
采纳的回答
Fangjun Jiang
2025-12-19,13:59
编辑:Fangjun Jiang
2025-12-19,13:59
should be
controlHandle.setSelectedItems(selectedItems)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Create Block Masks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!