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

Push button back color 3

Status
Not open for further replies.

Phil Thoms

Programmer
Oct 31, 2005
245
GB
I want to change the back color of a push button on a form in VFP version 6.0 but cannot seem to find a property to do this.
Any ideas?

Thanks
 
push button? You mean a commandbutton control?

The help on VFP6 is not at hand and not online anymore, but it should have a backcolor property, and it should override any windows settings, themes support cam in with vfp7, but vfp6 drew and draws controls itself with the colors you set.

If not you always could use an image control, it also has a click event...

Bye, Olaf.
 
VFP7 help is online at least:
Commandbutton had no backcolor in it, so most probable vfp6 hasn't had that, too. I know vfp9 has, and am quite sure vfp8 also.

Then you either would need to change system colors (not recommendable) or, as suggested, use an image instead.

Bye, Olaf.
 
There's no direct way to change the BackColor of a command button in VFP 6.0. (This was a much-requested feature that came in later.)

The two usual workarounds are:

- Create a an image file with the desired colours, and make its dimensions match that of the button. Set the button's Picture property to the name of the file.

- Or, use a Picture object in place of the button. Write code in its Click event to do whatever you want to do when the button is clicked.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
I see the FAQ Bart mentioned suggests using an ActiveX control in place of the native command button. While I agree that would work, I would personally prefer one of the other solutions. ActiveX controls are fine, but it adds another bit of complexity, and one more component that you have to distribute with the app.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Yes, Mike

And additional to that difficulty, the suite of Microsoft Forms ActiveX controls is part of Office and therefore there is no redistribution option. Only Office users would be able to use applications using those controls.

As a developer you may use any control you find on your computer. Doesn't mean that you can provide this to ohters in any case.

Foxpro comes with some activex control licenses for redistribution, you find them listed in some help topic. But I fear nothing as simple as a button. Shouldn't matter much, as the image solution is quite simple. You only have no pressed down and disabled look, but that can of course also be done via other pictures.

Bye, Olaf.
 
Hello and thanks for your replies.
I have solved this problem by either using a container or a shape tool, both have a click event within their properties.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top