Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkbox colours

Status
Not open for further replies.

coldan

Programmer
Oct 19, 2008
98
AU
I have seen apps ( maybe not VFP) that have a red background before selection then I want a white one with the tick in it.

Is this possible?

I can't identify any properties to do that.

Coldan
 
A checkbox has two components: the actual box, and the adjacent label. You can easily change the colours of the label, simply by using the ForeColor and BackColor properties. But there is no obvious way to change the colours of the box.

The only solution that comes to mind is not to use the native chackbox. Either look for a third-party ActiveX control, or create a pair of images that simulate the ticked and unticked boxes.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Thanks Mike,

I've already added separate labels for each checkbox and I'm experimenting with a 'ring' of red around the box when the value is 0.

I'll keep trying.

Coldan
 
As Mike suggested I have been using a class based on a text box that displays an "X" (or any other character you want) in bold when the underlying field is True and a space if False. This way I can control the background color based on the field value. The text box will accept a "T" or "Y" for True and an "F" or "N" for False. It also responds to mouse clicks to set the value. I also included a property that determines whether a False value has a red background or the default background color.

Auguy
Northwest Ohio
 
Be careful changing ANY color. You're likely to run into people that can't see it or even worse, run into legal issues, for example, the ADA in the US. Best suggestion is to leave things at defaults and let the form inherit the system colors set by the user.

Craig Berntson
MCSD, Visual FoxPro MVP,
 
To control the color you'll probably need to change it to a graphical checkbox.

Set style property to "1- graphical"
Set the picture property to an unchecked image.
Set the Down Picture property to the checked image.

Alan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top