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!

Command Button Back Color 2

Status
Not open for further replies.

FoxEgg

Programmer
Mar 24, 2002
749
0
16
AU
I must be losing it....

I can find no BACKCOLOR for command buttons.
Screen has colorsource and color scheme BUT NO BACK COLOR.


Form is blue --->

BACKCOLOR property set to (0, 100, 255)

Where do I set it for a command button ?

Thanks

John
 
HI FoxEng,

Are you a beginner.. student ?.
Command Buttons follow windows colour schemes and you cannot change them in forms property window. You can only change by changing the windows properties, either directly or thru VFP .. but then you will be changing for all windows applications as well. That is not wiser..

If you still need it, then.. remember to collect the original settings, and restore that back whenever the application looses focus, and redo it when it gets focus... not worth all this.. right ?

:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Thanks Ramani,

I am the world's best FoxPro underperformer... (learning VFP since 1996 and still no functioning application).. but FPD2.6 is NOOO Problemo

Student !! I wish.. 50+...

Nope I just program my Office Billing (Medical Practice)

OK so can you point me at some code....to get a blue Command Button

Thanks.

John
 
FoxEgg,
You are coming along fine. It took me from 1994 until 2002 to finally make the VFP leap, so you've still got 2 years to go. :-S
You can always make your own. This takes a little work, but could be well worth the effort (knowing what it is you want to do, and how often you'll want to do it). Just build one. You need Custom Control, The container Object base class, and a little work. (You can do it.)
Best Regards,
Scott

Please let me know if this has helped [hammer]
 
G'day Scott...

I just cannot seem to change the color from GREY

J.
 
FoxER,
You can always make them "Graphical" buttons, and cut little boxes of color out to fit them, and place your own text on the graphic before you put them in there. That will save you all the troubles making a custome button. Best Regards,
Scott

Please let me know if this has helped [hammer]
 
Dr. J,
I think I've solved your problem. I'll e-mail you the control in a few minutes.

Best Regards,
Scott

Please let me know if this has helped [hammer]
 
Thanks Scott both helped////

I'll test it tomorrow

JSF
 
Scott

Can I request a copy of your solution or ask you to FAQ it please. I've been trying to do this one but like FoxEgg I'm just not good enough - yet. I'm glad he had the sense to ask.

Thanks
John

email jbhowarth@travelstained.com
 
All,
For those interested in this custom button class, it is very simple. I have posted this to my FTP site, which can be reached at:

sentientsoftware.deadish.net

Login uising the ID: uaa
with passwords: uaa

You will see a folder called CODE. In that folder, there is another folder, CLASSES. In there are two files CUSTOMBUTT.VCX and CUSTOMBUTT.VCT. Download both of these, add them to your form control tool bar, and you're off to the races.
It is a very simple concept. There are two controls, one is a container object, the other is a label object. I didn't spend a lot of time on it, but it works very well. Just treat the label as any other label. I've added one line of code so that if someone clicks on the label within the button it calles the button's click event instead of the label's click event. (This.Parent.Click())
Nothing fancy, but it works very nicely. If you resize the button itself, you'll need to position your label accordingly. That's the only real difference between it, and the standard button class.

Best Regards,
Scott

Please let me know if this has helped [hammer]
 
FoxEgg

I'm not sure what TheManiac sent to you, since he won't share it with us ;-), but you can create a colored bitmap and put whatever you want on it (either text or picture or both ) and use the bitmap in the picture property of the commandbutton Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
All,
Two things for clarity: to reach the site, using your browser, enter:

ftp://sentientsoftware.deadish.net
Userid: uaa
Password: uaa

You will also find a copy of the current Alpha version of the application we are building. It's very different sort of app than most people build in VFP. If you'd like a copy of our program feel free to download it as well, (UAA.ACE), but know that it is around 36mb before you start! High speed connections are recommended.

Best Regards,
Scott

"Everything should be made as simple as possible, and no simpler."[hammer]
 
TheManiac

I guess the only disadvantage in using the container class is you lose some of the KeyPress event. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
FoxEgg, (and all others),
The good news is that VFP 8.0 does support BackColor (and ForeColor) on Command Buttons. It also will support 14 different ways to position a Picture with text on them. You'll just have to wait for early next year to actually get and use it!

Rick
 
you can create a colored bitmap and put whatever you want on it (either text or picture or both ) and use the bitmap in the picture property of the commandbutton

Mike that works like a charm... altho' less than friendly for changing caption and scalability... but it keeps all the code options...

John
 
Thanks to all.. great solutions... But I thought that would try and make some sense of the settings in the Properties for the command Box....(bit like Ramani suggested..)

And so... OK so I have read the "HELP" on selecting the color source for the FORM etc etc so I can change the color of a Command Box.. and Guys... it ain't no "help".

All of the above suggestion to date work... but Microsoft (or as Barrie Humphries says..."macrohard") must have a reason for not letting us select the backcolor (yet; until VFP8)..

So I played with the settings.. I am blowed if I can understand the color settings for a Command Button.. So, Ramani.. can I implore some help... How can I store the current settings... and then change them then reset at the end of the session. ?

Cheers..

John Fox
 
FoxEgg

This API function claims to do it. I don't know it doesn't do much.

Code:
#DEFINE COLOR_SCROLLBAR      0 
#DEFINE COLOR_ACTIVECAPTION  2 
#DEFINE COLOR_WINDOW         5 
#DEFINE COLOR_WINDOWFRAME    6 
#DEFINE COLOR_MENUTEXT       7 
#DEFINE COLOR_WINDOWTEXT     8 

    DECLARE INTEGER GetSysColor IN "user32" INTEGER nIndex 

    DECLARE INTEGER SetSysColors IN "user32"; 
        INTEGER nChanges,; 
        INTEGER @ lpSysColor,; 
        INTEGER @ lpColorValues 
     
    * save old color 
    lnSavedColor = GetSysColor (COLOR_WINDOWFRAME) 

    * change the color 
    nChanges = 1 
    lpSysColor = COLOR_WINDOWFRAME 
    lpColorValues = RGB (0, 0, 255)        && bright blue 
    ? SetSysColors (nChanges, @lpSysColor, @lpColorValues) 
     
    = MESSAGEB ("The window frame color is changed", 64, "Win32 SetSysColor") 
     
    * restore the old value 
    ? SetSysColors (nChanges, @lpSysColor, @lnSavedColor) 
    = MESSAGEB ("The window frame color is restored", 64, "Win32 SetSysColor")

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
Thanks Mike

FANTASTIC ! If only Tek-Tips gave you a $1000 per star.

Looks like I gotta learn some more about API functions now....

John
 
John,
Just remember that these types of change affect ALL applications currently running - not just yours, and some may not respond properly to this kind of system API call!

Note: Since Tek-Tips is asking for money just to keep going "free" (click the support Tek-Tips link at the top of this page on the right), I doubt there is much money available to be given away - especially to those of us who just enjoy sharing what we know!

Rick
 
G'day

And I used Mike's code which works well ... and I used faq184-1791 but I still cannot find an API instruction which changes the background color...

Any one any idea ?

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top