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!

BackColor property not changing

Status
Not open for further replies.

Phil Thoms

Programmer
Oct 31, 2005
245
GB
Hello,
I have a multi line grid with 5 text fields which works superbly. However, I have changed the 5 text fields to read only and the background is now grey instead of white. When in read only mode the backcolor property does not change to any color in the regular way. Am I overlooking something as I want all the background to display in white ?

Many thanks.

PT
 
There is a DisabledBackColor Property.

Within a Grid it's easier to use a combination of ReadOnly and RETURN .F. in When event, though. This a) prevents writing into the textbox, b) prevents cursor/focus to get into the textbox like in disabled mode and c) enables you to still use DynamicBackcolor for colring, there is no DynamicDisabeldBackcolor, as it's standard UI/UX to have disabled controls greyed out.

Bye, Olaf.
 
Thanks Olaf,
All working well. I also take your other point using the When event.

PT.
 
Within a Grid it's easier to use a combination of ReadOnly and RETURN .F. in When event

The trouble with returning .F. in the When event is that you can't do anything at all in the grid: resizing or moving columns, or even using the scrollbars. A better solution is to set the grid's AllowCellSelection to .F. This also prevents the cells getting focus, and it also allows the use of DynamicBackColor, but it doesn't prevent basic interaction with the grid.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Not in the [tt]Grid.When[/tt] Event, Mike. In the individual Controls When event.

AllowCellSelection=.F. is a good choice, if you don't want any cell to be selectable. But that's a special case. If you only want some columns to be disabled and still be displayed in the backcolor or dynamicbackcolor, the When event of the column control is very useful.

Bye, Olaf.
 
Thanks again to Olaf and Mike.

I don't think AllowCellSelection is in VFP6.

PT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top