The
ThisForm.SetAll("DynamicBackColor",... is fine, this is for to highlite the whole row for easier viewing. Then, if there is an error, thats where I change the logic of "changebc" (change backcolor, just a variable). If the changebc is .T., then I am forced to turn OFF the blue ROW highlite in order to SHOW the backcolor of the field(s). There is no view, cursor, whatever, this is a
live grid, using TableUpdate() and TableRevert() to update the changes. The
ThisForm.SetAll("DynamicBackColor",... part is working fine and great. I just need to overwrite the backcolor to highlite the required fields, thats all... The changebc is defined in main.prg as "changebc = .F." I can not use the backcolor in the properties since there are different requirements for different things, so I need to do the backcolor by coding.
Chuck
>There are a few points in the code not very clear. What's changebc? It is a form property? It is a variable? Is so, where it is defined and what's its scope?
>
>Also, say you want to highlight individual fields, but your issueing a
ThisForm.SetAll("DynamicBackColor",... that does nothing, as no form child has this property. It just applies to the grid column object, so if you want ALL your columns to share a common criteria to change the backcolor, you use
ThisForm.YourGrid.SetAll("DynamicBackColor",....
>
>Anyway, as you want to highlight each field individually, what I recommend is to scan trough the cursor evaluating every condition and setting a
semaphore field that tells you if each column is ok or not, such as "00101" would tell you the third and fifth fields are not valid.
>
>Then, you can set each column DynamicBackColor separately with something like:
>
>
>
>>The following codes are for the record-level validation (in the table):
>
>>FUNCTION authverfield
>>wait window "going thru the authverfield"
>> DO CASE
>> CASE ALLTRIM(UPPER(authtype)) = "VISA"
>> IF limit = 0 OR ;
>> EMPTY(fund) OR ISNULL(fund) OR ;
>> EMPTY(account)OR ISNULL(account) OR ;
>> EMPTY(program) OR ISNULL(program)
>> =Messagebox("The VISA must have :"+CHR(13)+ ;
>> "LIMIT, FUND, PROGRAM, and ACCOUNT",64,"Bad Data")
>> changebc = .T.
>> wait window "changebc = .T."
>> RETURN .F.
>> ENDIF
>> OTHERWISE
>> changebc = .F.
>> wait window "changebc = .F."
>> ENDCASE
>>ENDFUNC
>>
>>The following codes are for the Grid:
>>
>>* Authform Grid1 AfterRowColChange
>>LPARAMETERS nColIndex
>>ThisForm.nGridRecno = RECNO("auth")
>>This.Refresh()
>>
>>* Authform Grid1 Init
>>ThisForm.SetAll("DynamicBackColor", ;
>>"IIF(RECNO('auth') =ThisForm.nGridRecno, RGB(193,255,255),"+ ;
>>"RGB(255,255,255))", "Column")
>>
>>* Authform Grid1 Refresh
>>DODEFAULT()
>
>>
>>The following codes are for the Save button:
>>
>
>>* Authform SAVE ClickEvent
>>=TableUpdate(.T.)
>>IF changebc = .T.
>> wait window "should change color here"
>> ThisForm.SetAll("DynamicBackColor", ;
>> "IIF(RECNO('auth') =ThisForm.nGridRecno, RGB(255,255,255),"+ ;
>> "RGB(255,255,255))", "Column")
>> ThisForm.Grid1.Column6.Text1.BackColor = RGB(255,255,128)
>> ThisForm.Refresh
>> RETURN .F.
>>ENDIF
>
>
>>
Today is tomorrow's yesterday.