cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
csoon1
Level III

How to Programmatically Select an Item in a ListBox

I have a ListBox (not VListBox). Normally when I click at each item using a mouse, the item will be highlighted.

 

Now I have a list() that contains some items. The items on the list() do not necessarily match the items on the ListBox. Through code, I want to automatically select (highlight) the items on the ListBox that are present on the list(). For example: If my ListBox contains the items {"a", "b", "c", "d", "e"}... and my list contains {"c", "e"},... I want items "c" and "e" to appear highlighted on my ListBox.

 

I am using JMP13. If you have any suggestions please let me know.

1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: How to Programmatically Select an Item in a ListBox

L1 = {"a", "b", "c", "d", "e"};
L2 = {"a", "b"};

New Window("Example", lb = List Box(L1));

For(i = 1, i <= N Items(L2), i++,
    lb << set selected(Loc(L1, L2[i]))
);

 

View solution in original post

2 REPLIES 2
ms
Super User (Alumni) ms
Super User (Alumni)

Re: How to Programmatically Select an Item in a ListBox

L1 = {"a", "b", "c", "d", "e"};
L2 = {"a", "b"};

New Window("Example", lb = List Box(L1));

For(i = 1, i <= N Items(L2), i++,
    lb << set selected(Loc(L1, L2[i]))
);

 

csoon1
Level III

Re: How to Programmatically Select an Item in a ListBox

@ms. This makes sense. I'll try it later then I will provide an update. Thanks!