cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
SophieCuvillier
Level III

Bold specific items in a list box

Hello,

 

I would like to higlight in bold specific values in a list box. Is it possible ?

For instance in the example below, I would like to put in bold only "Second Item"

 

New Window( "Example",
	fontobj = lb = List Box(
		{"First Item", "Second Item", "Third Item"},
		width( 200 ),
		max selected( 2 ),
		nlines( 6 )
	)
);
1 ACCEPTED SOLUTION

Accepted Solutions
ErraticAttack
Level VI

Re: Bold specific items in a list box

There are many reasons I can think of why bolding / formatting specific entries in a list box could be useful!  I have an app where I allow for quick browsing of my API features in a way very similar to the JMP Scripting Index.  In order to allow for the formatting that helps with visual parsing I've had to re-create list boxes using Table Box and COL Box, wrapped inside of a mouse-box to be able to know which item is being clicked on and perform certain actions based on that (like disallowing certain entries from being selected).

 

It was a lot of work, but now it is simply a widget that I can embed in any script with one line of code, just like the built-in list box.

 

The two list boxes in this script are indeed TableBoxes wrapped within a mouse box, but the added ability for individual entry formatting is undeniable. 

ErraticAttack_1-1702673667909.png

 

@SophieCuvillier , the short answer is no -- JMP does not provide any capabilities for us lowly scripters to modify the individual entries in a list box.  They do have that capability, as the JMP Scripting Index does it with the list boxes they use.

 

If you're endeavorous you can make TableBoxes behave like a list box, but it does require a bit of work.  I cannot give out my code for it per my companies regulations, but I'd be willing to help answer any questions if needed.

Jordan

View solution in original post

6 REPLIES 6
jthi
Super User

Re: Bold specific items in a list box

I think with list boxes you can only set which is selected or style for all the items. Is there a specific reason why you would like to bold single option?

Names Default To Here(1);

nw = New Window("Example",
	lb = List Box(
		{"First Item", "Second Item", "Third Item"},
		width(200),
		max selected(2),
		nlines(6)
	)
);

lb << Set Selected(2);
lb << Set Font Style("Italic Bold Underline");
-Jarmo
ErraticAttack
Level VI

Re: Bold specific items in a list box

There are many reasons I can think of why bolding / formatting specific entries in a list box could be useful!  I have an app where I allow for quick browsing of my API features in a way very similar to the JMP Scripting Index.  In order to allow for the formatting that helps with visual parsing I've had to re-create list boxes using Table Box and COL Box, wrapped inside of a mouse-box to be able to know which item is being clicked on and perform certain actions based on that (like disallowing certain entries from being selected).

 

It was a lot of work, but now it is simply a widget that I can embed in any script with one line of code, just like the built-in list box.

 

The two list boxes in this script are indeed TableBoxes wrapped within a mouse box, but the added ability for individual entry formatting is undeniable. 

ErraticAttack_1-1702673667909.png

 

@SophieCuvillier , the short answer is no -- JMP does not provide any capabilities for us lowly scripters to modify the individual entries in a list box.  They do have that capability, as the JMP Scripting Index does it with the list boxes they use.

 

If you're endeavorous you can make TableBoxes behave like a list box, but it does require a bit of work.  I cannot give out my code for it per my companies regulations, but I'd be willing to help answer any questions if needed.

Jordan
hogi
Level XI

Re: Bold specific items in a list box

wow!

SophieCuvillier
Level III

Re: Bold specific items in a list box

Hello,

 

Thank you very much @jthi and you for the answer. I need to highlight certain values in bold because they have a different utility for users than other values and they want to be able to differentiate them visually just by the name displayed.

 

@ErraticAttack  Your answer helped me a lot, thank you. I'm going to make a box table that mimics the behavior of a box list and bold the values I want in it.

 

 

Re: Bold specific items in a list box

What if you split the list into two lists?

SophieCuvillier
Level III

Re: Bold specific items in a list box

I need to have all the values (bold and not bold) in the same place, it must be sorted by alphabetical order