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!

Grid Row and column coloring

Status
Not open for further replies.

beedubau

Programmer
Jan 7, 2003
97
AU
I have hand coded grid on a form.

I have a textbox control in Column 2

I want to use both alternate rows in grey and a particular column in another constant colour incolumn 2.

Code:
THIS.SETALL("dynamicbackcolor","IIF(MOD(recno(), 2) = 0, RGB(192,192,192), RGB(255,255,255))")
	
THIS.Column2.dynamicbackcolor = RGB(0,255,255)

This ignores the column color.

If I use .backcolor = RGB(0,255,255) in the column's properties it only shows in empty rows.

Can I have both?

Regards

Bryan
 
Bryan,

Your basic logic is correct. You start by setting the DynamicBackColor of all the columns. You then override the setting for Column 2. So far, so good.

The problem lies in the syntax of your second command. Essentialy, you need to put RGB(0,255,255) in quotes. Thus:

Code:
THIS.Column2.dynamicbackcolor = [b]"[/b]RGB(0,255,255)[b]"[/b]

The reason is that the DynamicBackcolor needs to be an expression. If you don't have the quotes, you will be setting it to an integer.

Hope this makes sense.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike,

Thanks for that.

Trying both before and after the line

THIS.SETALL("dynamicbackcolor","IIF(MOD(recno(), 2) = 0, RGB(192,192,192), RGB(255,255,255))")

I find I can only have either grey or blue or on a particular cell...?

Can I put a bold capital 'P' in every column2 cell somehow instead?
A click on the column2 cell leads to an 'open' on the file type as on your pages.

Regards

Bryan
 
Bryan,

You said "I find I can only have either grey or blue or on a particular cell...?"

I'm not sure what else you were expecting. Do you want to have two colours in the same cell? That's not possible.

But, yes, you can put a bold letter in selected cells. Check DynamicFontBold (or any of the other dozen or so Dynamic... properties). These can be freely combined to produce many different effects.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 

You may try this

Code:
for ii = 1 to this.ColumnCount  && new line
    iic = ltrim(str(ii,3))      && new line
    THIS.column&iic..dynamicbackcolor = "IIF(MOD(recno(), 2) = 0, RGB(192,192,192), RGB(255,255,255))"
endfor  && new line
    
THIS.Column2.dynamicbackcolor = "RGB(0,255,255)"

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top