BookmarkSubscribe
Choose Language Hide Translation Bar
dqr2
Community Trekker

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.

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
msharp
Super User

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

0 Kudos
3 REPLIES 3
msharp
Super User

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

0 Kudos
dqr2
Community Trekker

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.

0 Kudos
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);

0 Kudos