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

Grid Header Colour

Status
Not open for further replies.

AlastairP

Technical User
Feb 8, 2011
286
AU
Good morning

I am trying to find the setting where I can change the colour of the grid header when clicked/mouse down.
If I change the Grid Header backcolor property, then it seems to select a random colour for the clicked/mouse down event of the grid header and I can't seem to find a way to customise this colour.

Anybody found a way around this?

Alastair
 
1. Only with Grid.Themes = .F. you have full control about colors
2. There only is Backcolor and Forecolor. A Header is no button.

Don't force looks on a VFP application, if you really are after modern UI, you should really change the programming language and go for an HTML or WPF application. Or use Objective C with Cocoa on a Mac.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Alastair, these are not random colours. When you click on a grid header, the backcolor becomes the forecolour and the forecolor becomes the backcolor. If you want to override that, you can write code in the header object's MouseDown to change the colours, then in the MouseUp to restore them.

But why do you want to do this? The reason that VFP changes the colours when you click the header is to give visual feedback to the user. Why do you want to change that?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I see a subtle difference:

Win10 with themes: The header changes from a light to a slightly darker color. In my case blue, I think it depends on themes, Win10 even has that automatic mode about a color matching the desktop background image.
Win10 without themes: The header is grey unclicked and turns white text on dark grey clicked. Changing colors I see the clicked header is simply inverting colors, ie red turns cyan. White turns black.

So when you absolutely want to have the color you want, you have to set Themes = .F. and do as Mike suggests. But in more detail, you need to set the BackColor and ForeColor to the inverse color of what you want. VFP inverts that. If you invert colors yourself so they actually stay as they are, you see the click still changes the border of the header. So you always see a visual feedback of the click, even if you would minimize it.

Also always make a testdrive with the compiled EXE. The visual experience differs a bit at least about the titlebar of your app vs IDE.

Bye, Olaf.


Olaf Doschke Software Engineering
 
Mike,
I have worked out what the colours do:
The colours invert.
So if the forecolor is RGB(0,0,0) when normal, then forecolor will be RGB(255,255,255) when mouse down
If you set the forecolor to say RGB(10,255,120), then the forecolor will be RGB(245,0,135) when mouse down
The same applies for the backcolor. That is why it appears to give random back colours. If you set the backcolor to blue, it will give an orange colour when mouse down.

Alastair
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top