widgets-toolbox
widgets-toolbox copied to clipboard
List Selector (two pane) can crash MATLAB due to HighlightedValue being empty in the set method
g3198185 - The error comes from ListSelectorTwoPane.m. The following update is proposed:
function set.HighlightedValue(obj,value)
if isempty(value)
return;
end
if isempty(obj.ItemsData)
[~, obj.RightList.Value] = ismember(value, obj.Items);
else
[~, obj.RightList.Value] = ismember(value, obj.ItemsData);
end
end
Question on this change:
Would the following proposal also solve the issue (I cannot reproduce it) and still allow for de-selection of the highlighted value?
function set.HighlightedValue(obj,value)
if isempty(value)
obj.RightList.Value = {};
return;
end
if isempty(obj.ItemsData)
[~, obj.RightList.Value] = ismember(value, obj.Items);
else
[~, obj.RightList.Value] = ismember(value, obj.ItemsData);
end
end
Yes that's a good idea. Was the right list not getting deselected before? You're welcome to submit a change.
Currently, the right list is not deselected if HighlightedValue is set to an empty value. I will submit a change to repair this.