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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

option button colour

Status
Not open for further replies.

Simonbegg

MIS
Sep 17, 2002
30
0
0
GB
Afternoon All,
I would like to create an option group that looks like a set of traffic lights (red, amber, green).
No captions on the option - just change the colour of the buttons as they are selected.
As yet I cannot find out how to chnage the colours of the buttons. Any ideas?
Cheers
Simon
 

I've tried it long ago (and this question also appeared on Tek-Tips a few times before), but I seem to remember that you cannot really change option button's background color (if you mean the one inside the circle).

This color depends on your Windows color scheme. If you want several differently colored option buttons on one form or even one option group, I don't think you can do it using standard option group class.

Your best bet seems to be creating your custom option group class, using some image editor to color a clipping of an option button image, and then writing the code for it.

Another option would be to give up your idea of coloring inside the circles, and color just the background of the labels of each of the options - that is easy to do just by changing the background color of each option separately, either at the design time, or at run time, say, in the "Click" method. Not as pretty as you want it to be, but much faster to implement.

 
If you change the style of the option buttons to Graphical then you can set the BackColor property of each one to red, amber and green.

With a bit more work you caould use the Picture and DownPicture properties to change the appearance of the button as it becomes selected.

Geoff Franklin
 
I used to do something like this (in FPW 2.6) by using graphical radio buttons with small .bmp files that represent red, green or grey(for off) LED panel lights.
I then used SHOW GET...PROMPT in the WHEN & VALID snippets to change the colour according to which button was pressed. That was a long time ago of course, and I can't remember the exact code 'behind' the buttons, but I imagine it's possible in VFP.

Roger
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top