Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid backcolor
Message
 
 
À
22/01/2001 17:40:34
Chuck Tripi
University of Wisconsin - Milwaukee
Milwaukee, Wisconsin, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00467031
Message ID:
00467212
Vues:
13
Hello, Chuck.


>Yeah, I did a thread recently about that and I am still not getting this to work. I did even tried the DynamicBackColor (in the Save button below), it still didn't work...

>Sorry to post all those codes, but I do that to see if you may catch some of the errors. I have other errors too, but this one need to be working to solve the other errors. What I want to accomplish here is to get the SAVE button to work. That is, if there is a missing data in the field(s) (via, for VISA), I want to stop the blue row highlite (193,255,255) and highlite the specific FIELDs (not column or row) that are required (225,225,128 I only have one in the above in the SAVE button). Then after that, turn it back as it was before... the only reason I am trying to stop the blue row highlite is because if not, the regular backcolor would never show up, unless you can fix that otherwise. BTW, I did changed the Column6 to Sparse = .F.



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:
with thisform.yourGrid
   .col1.DynamicBackColor = "iif( subs( semaphore, 1, 1) ='0', X, Y"
   .col2.DynamicBackColor = "iif( subs( semaphore, 2, 1) ='0', X, Y"
   .col3.DynamicBackColor = "iif( subs( semaphore, 3, 1) ='0', X, Y"
   ...
endwith
Where X and Y are the Good and Bad rgb() color expressions.
I have to point that this code is just a sample and is not to cut and paste, but to give you an idea of what you can do.

Hope this helps.




>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
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform