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

Colored Command Buttons with @ ...Get 1

Status
Not open for further replies.

rwesiuc

Programmer
Mar 6, 2001
12
US
Here is a fun one for you...

I have a 2.6 spr running in VFP9, and the buttons background color is white. VFP6 was the standard grey, similar to my forms color.

The buttons are created with the @ ...Get command and I know most of the codes in the Picture portion of the command, but I never found how to change the colors in 2.6, and VFP never gives you any information in their help section for @ ... Anything because it was included for backward compatibility.

Any clues?

Bob
 
I bet this is about themes. Turn off themes support early in the application: _SCREEN.Themes = .F.

Tamar
 
I thought you were on to something, but it still does not work. I know the old way was adjusting the PICTURE clause of the @ ... Get and the color was supposed to be adjustable to Flat Black and White with '2'. It seems as if the VFP8/9 defaults to that with no adjustment available to the original default. I've tried 0,1,-1,2,3,4,5, etc. with no luck.

Bob
 
Bob,

I would dig up your old Foxpro 2.6 for Windows help file (it will be called Foxhelp.hlp) for documentation. I using VFP 8 (9 on order) and I still reference the Foxhelp.hlp file on a weekly basis. I just keep copying this file from version to version to version.

Malcolm
 

Bob,

I have old FoxPro help printed only, with no version number specified (dated 1991), so I cannot get it all typed here, but I would suggest you to experiment with clauses COLOR|COLOR SCHEME.

Here is a quote from the Help book:

Code:
[b]@...GET - Push Buttons[/b]
.
.
.
COLOR SCHEME <expN4>
COLOR <color pair list>

By default, the colors of a push buttons are derived from the color scheme of the current output window or screen. A color scheme is a set of 10 color pairs that describe the color characteristics of a window. You can override the current color scheme by specifying a different a different pre-defined color scheme or by specifying a list of color pairs.

This example shows how to override one color scheme with another pre-defined color scheme:
[COLOR=navy]
STORE 1 TO choice
@ 5,0 GET choice FUNCTION '* \<OK;\<CANCEL' COLOR SCHEME 4
READ
[/color]
By specifying a color pair list for a set of push buttons, you can assign different color characteristics to [i]individual[/i] buttons within a set. The color pair list is a list of 10 color pairs separated by commas. The first half of a pair specifies the background color. The following table lists the color pairs and what each color pair in the list controls.

Color Pair Number      Push Button Attribute
===============================================
...
 5                  Message
 6                  Selected button prompt 
 7                  Hot keys
 9                  Enabled button prompt
10                  Disabled button prompt

Color pairs that I skipped are not used by push buttons.

Stella
 
As luck would have it i got an answer to this from Foxpro tech support via MSDN yesterday

alas, you have to add a color clause to each @ GET....

e.g.

m0wcolr = "RGB(0,0,0,192,192,192)" + ;
",RGB(0,0,0,255,255,255)" + ;
",,,,RGB(0,0,0,255,255,255)"+;
",,,RGB(0,0,0,236,233,216)"


@ 18.563,15.000 GET m.rec_btn ;
PICTURE "@*HN Hello World" ;
SIZE 1.429,14.600,0.800 ;
DEFAULT 1 ;
FONT "Arial", 8 ;
STYLE "B" ;
color (m0wcolr )



hth

Nigel
 
FYI: This is how I did this quickly for my 2.6 project's screen files. I modified GENSCRN in the 2.6 home() directory. I took the push (command) button's creation area, where it types out the @ ... Get portion of the code to the spr file, and modified it to include a COLOR line. My 2.6 runtime just ignores the COLOR portion, but it is read in VFP9. I guess I could have hard coded the color, but I kept it a variable that needs to be defined in my starting program. This way, I can change it when necessary.

That reminds me, I like my one project to have modal screens. I sometimes forget to check the box on every screen. I modified the GENSCRN to always be modal.

Thanks Again Nigel,

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top