BookmarkSubscribe
Choose Language Hide Translation Bar
Highlighted
csoon1
Community Trekker

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.

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User ms
Super User

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]))
);

 

2 REPLIES 2
ms
Super User ms
Super User

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
Community Trekker

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!

0 Kudos