Skip to content

Commit 6eb5586

Browse files
committed
Take ItemsData into account while showing AddList
1 parent 6d12ecb commit 6eb5586

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

widgets/+wt/ListSelector.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,12 +439,18 @@ function onButtonPushed(obj,evt)
439439
function promptToAddListItems(obj)
440440
% Prompt a dialog to add items to the listbox
441441

442+
% Take ItemsData into account while displaying Items
443+
items = obj.Items;
444+
if ~isempty(obj.ItemsData)
445+
items = items(1:min(numel(items), numel(obj.ItemsData)));
446+
end
447+
442448
% Prompt for stuff to add
443449
if obj.AllowDuplicates
444-
newSelIdx = listdlg("ListString",obj.Items);
450+
newSelIdx = listdlg("ListString",items);
445451
else
446452
newSelIdx = listdlg(...
447-
"ListString",obj.Items,...
453+
"ListString",items,...
448454
"InitialValue",obj.ListBox.ItemsData);
449455
end
450456

0 commit comments

Comments
 (0)