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!

How can I 'grey out' a grid?

Grids

How can I 'grey out' a grid?

by  ChrisRChamberlain  Posted    (Edited  )
If you want to disable and show a grid 'greyed out', the default .DisabledBackColor for a textbox is white, while you perhaps run an external application or something similar, try the following code.

The default .DisabledBackColor for a textbox is white
You will need to replace the various values with those relevant to your application.

You will also need to change the .DisabledBackColor property of any checkboxes you may have in a column(s) to say RGB(128,128,128) to prevent white showing as the background colour.

The example shows the selected row highlighted and these values will also need examining.
[color blue]
WITH THISFORM.Grid1
.SetAll([BackColor],RGB(212,208,200),[Column])
.SetAll([ForeColor],RGB(128,128,128),[Column])
.SetAll([ForeColor],RGB(128,128,128),[Header])
.SetAll([DynamicBackColor] ,;
"IIF(RECNO([TABLENAME]) = THISFORM.nRecNo ,;
RGB(212,208,200) ,;
RGB(212,208,200))" ,;
[Column])
.SetAll([DynamicForeColor] ,;
"IIF(RECNO([TABLENAME]) = THISFORM.nRecNo ,;
RGB(128,128,128) ,;
RGB(128,128,128))" ,;
[Column])
.Enabled = .F.
[tab].Refresh()
ENDWITH
[color green]
* Run other process and then enable grid
[color blue]
WITH THISFORM.Grid1
.SetAll([BackColor],RGB(255,255,255),[Column])
.SetAll([ForeColor],RGB(0,0,0),[Column])
.SetAll([ForeColor],RGB(0,0,0),[Header])
.SetAll([DynamicBackColor] ,;
"IIF(RECNO([TABLENAME]) = THISFORM.nRecNo ,;
RGB(10,36,106) ,;
RGB(255,255,255))" ,;
[Column])
.SetAll([DynamicForeColor] ,;
"IIF(RECNO([TABLENAME]) = THISFORM.nRecNo ,;
RGB(255,255,255) ,;
RGB(0,0,0))" ,;
[Column])
.Enabled = .T.
[tab].Refresh()
ENDW
[color black]
Have fun! [smile]
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top