cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-37043%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EComment%20s%C3%A9lectionner%20par%20programmation%20un%20%C3%A9l%C3%A9ment%20dans%20une%20ListBox%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-37043%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EJ'ai%20une%20ListBox%20(pas%20VListBox).%20Normalement%2C%20lorsque%20je%20clique%20sur%20chaque%20%C3%A9l%C3%A9ment%20%C3%A0%20l'aide%20d'une%20souris%2C%20l'%C3%A9l%C3%A9ment%20est%20mis%20en%20surbrillance.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMaintenant%2C%20j'ai%20une%20liste%20()%20qui%20contient%20certains%20%C3%A9l%C3%A9ments.%20Les%20%C3%A9l%C3%A9ments%20de%20la%20list()%20ne%20correspondent%20pas%20n%C3%A9cessairement%20aux%20%C3%A9l%C3%A9ments%20de%20la%20ListBox.%20Gr%C3%A2ce%20au%20code%2C%20je%20souhaite%20s%C3%A9lectionner%20(mettre%20en%20surbrillance)%20automatiquement%20les%20%C3%A9l%C3%A9ments%20de%20la%20ListBox%20qui%20sont%20pr%C3%A9sents%20sur%20la%20liste%20().%20Par%20exemple%26nbsp%3B%3A%20Si%20ma%20ListBox%20contient%20les%20%C3%A9l%C3%A9ments%20%7B%22a%22%2C%20%22b%22%2C%20%22c%22%2C%20%22d%22%2C%20%22e%22%7D...%20et%20ma%20liste%20contient%20%7B%22c%22%2C%20%22e%22%7D%2C...%20Je%20veux%20que%20les%20%C3%A9l%C3%A9ments%20%22c%22%20et%20%22e%22%20apparaissent%20en%20surbrillance%20sur%20ma%20ListBox.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJ'utilise%20JMP13.%20Si%20vous%20avez%20des%20suggestions%2C%20s'il%20vous%20pla%C3%AEt%20faites-le%20moi%20savoir.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-37050%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20Comment%20s%C3%A9lectionner%20par%20programme%20un%20%C3%A9l%C3%A9ment%20dans%20une%20liste%20d%C3%A9roulante%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-37050%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F182%22%20target%3D%22_blank%22%3E%40SP%3C%2FA%3E%20.%20C'est%20logique.%20Je%20vais%20essayer%20plus%20tard%2C%20puis%20je%20fournirai%20une%20mise%20%C3%A0%20jour.%20Merci!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-37049%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20Comment%20s%C3%A9lectionner%20par%20programme%20un%20%C3%A9l%C3%A9ment%20dans%20une%20liste%20d%C3%A9roulante%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-37049%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3EL1%20%3D%20%7B%22a%22%2C%20%22b%22%2C%20%22c%22%2C%20%22d%22%2C%20%22e%22%7D%3B%0AL2%20%3D%20%7B%22a%22%2C%20%22b%22%7D%3B%0A%0ANew%20Window(%22Example%22%2C%20lb%20%3D%20List%20Box(L1))%3B%0A%0AFor(i%20%3D%201%2C%20i%20%26lt%3B%3D%20N%20Items(L2)%2C%20i%2B%2B%2C%0A%20%20%20%20lb%20%26lt%3B%26lt%3B%20set%20selected(Loc(L1%2C%20L2%5Bi%5D))%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
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!

Recommended Articles