Subscribe Bookmark RSS Feed

Changing the text color of a check box

dqr2

Community Trekker

Joined:

Jun 19, 2015

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
Solution

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

3 REPLIES
Solution

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

dqr2

Community Trekker

Joined:

Jun 19, 2015

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

Joined:

Jun 23, 2011

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