Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Make the whole row of the grid to use the same forecolor
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00525731
Message ID:
00525947
Views:
19
>In simplest case, if you did not move columns around and assuming that all columns have textboxes you can place the following in OnPostHighlightRow() method:
>
>lcHost = THIS.chostname
>lnColumn = THIS.PARENT.&lcHost..ActiveColumn
>loControl = THIS.PARENT.&lcHost..Columns(lnColumn).Text1
>loControl.ForeColor = < your conditional color here or IIF returning it >
>
>
>If not - before you set that forecolor, you will need more code to determine also which column is really ActiveColumn, which control in it is CurrentControl, does that CurrentControl have ForeColor property.

Hi Nick,

I moved columns around and I even removecolumn in Grid.Init, if thisform.ProcType<>'prlcproc' I have status field in the table. If status field is '6', I want all these records to have blue forecolor, if '5' - green, etc.

This is how it's set up now:
		.newobject('grdBldMstr','grdSitus','AddrStd.vcx')
	endcase
	dodefault() && Will set proper filter && Nadya Nosonovsky 06/28/2001 09:50:17 PM
	.newobject("grdHglt1", "GrdHglt", "addrstd.vcx",, "grdBldMstr")
	with .grdBldMstr
		.left=1
		.top=1
		.width=min(m.lnFormWidth-5-m.lnEdtNotesWidth,.width)
		.height=m.lnFormHeight
		.visible=.t.
*		.setall('DynamicForeColor', "thisform.myforecolor(BldMstr."+thisform.AddrField+")", 'Column')
	endwith
I moved last commented line into gridhighlighter OnPostSetDynamicColor method.

This is form myForeColor method:
********************************************************************
*  Description.......: AddrStdMain.myForeColor - sets grid's forecolor depending on Status field value
*  Calling Samples...: 
*  Parameter List....: 
*  Created by........: Nadya Nosonovsky 06/29/01 11:31:54 PM 
*  Modified by.......: 
********************************************************************
lparameter tcFieldVal
local lnColor
if vartype(m.tcFieldVal)<>"C"
   tcFieldVal=evaluate('BldMstr.'+thisform.AdddrField)
endif   
* --	changed the fore color of the whole row 
* --	red = auto suspect 
* --	blue = manually resolve 
* --	green auto-correct 
* --	highlight the selected line light blue ... 
*--------------------------------------------------------------------------
local lnColor
do case
    case m.tcFieldVal='5'
         lnColor=rgb(255,0,0) && Auto-suspect
    case m.tcFieldVal='4'
         lnColor=rgb(0,128,0) && Auto-correct    
         
    case m.tcFieldVal='6' && Manually-resolved
         lnColor=rgb(0,0,255)
    otherwise
         lnColor=rgb(0,0,0) && Black
endcase
return m.lnColor
Each column in the grid has only one control text1. Actually, that's not a normal text1, but my addrInGrid, which I placed here instead of text1. Sparse is set to .t. for all columns. When I'm sitting on the highllighted record, which has blue forecolor, the active column is displayed in black. I tried addrInGrid GotFocus event without any lack. My question is: is it possible to set gridhighlighting forecolor to be a function? Why GotFocus() doesn't work?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform