cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
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!