cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
DMR
DMR
Level V

Changing the text color of a check box

Hi - I want to change both the text color and the background color of a check box.  The following short example demonstrates that the background color is being changed to red and a border is being added as I'd expect, but the text color is not being changed to yellow as requested.  The properties appear to be correct.  Am I doing something silly here?

cb = check box("Hi There!  ", beep(), << text color("yellow"), << background color("red"), << border(1));

nw = new window("My Window", cb);

show properties(cb);

Many thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
msharp
Super User (Alumni)

Re: Changing the text color of a check box

Seems like Text Color isn't very universal.  It works in some cases (i.e. captions) but not in others.  You could always just create a text box next to the checkbox and color the text there with << Font Color().

tb = text box("Hi There!");

cb = check box("", beep());

nw = new window("My Window", hlistbox(cb,tb));

tb << Font Color("yellow") << background color("red") << border(1);

View solution in original post

3 REPLIES 3
msharp
Super User (Alumni)

Re: Changing the text color of a check box

Seems like Text Color isn't very universal.  It works in some cases (i.e. captions) but not in others.  You could always just create a text box next to the checkbox and color the text there with << Font Color().

tb = text box("Hi There!");

cb = check box("", beep());

nw = new window("My Window", hlistbox(cb,tb));

tb << Font Color("yellow") << background color("red") << border(1);

DMR
DMR
Level V

Re: Changing the text color of a check box

Yes, it looks like that's the best way to do it.  Also I note I that can get the background color to surround the check box by putting the whole thing inside a border box like this:

tb = textbox("Hi there! ", << font color("white"), << set font style("bold"));

bb = borderbox(hlistbox(checkbox("", beep()), tb), << background color("red"), << border(1));

nw = new window("My Window", bb);

Many thanks.

pmroz
Super User

Re: Changing the text color of a check box

I couldn't get that code to work in JMP 11.  This works however:


nw = new window("My Window",

      hlistbox(

            cb = check box(""),

            bb = border box(tb = text box("Hi There!"))

      )

);

tb << Font Color("yellow");

bb << set background color("red") << sides(15);