Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid's DynamicBackColor
Message
De
22/01/2005 18:49:01
 
 
À
01/01/2005 21:19:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
00973619
Message ID:
00979706
Vues:
14
Hi, Jos
Thanks again for your reply.
I didn't get to try your suggested method until I got back from Malaysia.
I tried it on the sample foxpro code I got from the help file but still couldn't get it. Did I do it wrongly?

Here is the code:
CLOSE ALL  && Close tables and databases
OPEN DATABASE (HOME(2) + 'data\testdata')

USE customer  IN 0  && Opens Customer table

frmMyForm = CREATEOBJECT('Form')  && Create a Form
frmMyForm.Closable = .F.  && Disable the window pop-up menu
frmMyForm.AutoCenter=.T.
frmMyForm.AddObject('cmdCommand1','cmdMyCmdBtn')  && Add Command button
frmMyForm.AddObject('grdGrid1','Grid')  && Add Grid control
frmMyForm.grdGrid1.Left = 25  && Adjust Grid position

frmMyForm.grdGrid1.Column2.DynamicBackColor=CellColor(CUST_ID)

frmMyForm.grdGrid1.Visible = .T.  && Grid control visible
frmMyForm.cmdCommand1.Visible =.T.  && "Quit" Command button visible
frmMyForm.grdGrid1.Column1.Header1.Caption = 'Customer ID'

frmMyForm.SHOW  && Display the form
READ EVENTS  && Start event processing

DEFINE CLASS cmdMyCmdBtn AS CommandButton  && Create Command button
   Caption = '\<Quit'  && Caption on the Command button
   Cancel = .T.  && Default Cancel Command button (Esc)
   Left = 125  && Command button column
   Top = 210  && Command button row
   Height = 25  && Command button height

   PROCEDURE Click
      CLEAR EVENTS  && Stop event processing, close form
      CLOSE ALL  && Close table and database
ENDDEFINE

FUNCTION CellColor
 PARAMETERS CellData
 PRIVATE thiscolor,thiscell
 thiscell=CellData
 DO Case
  CASE SUBSTR(thiscell,1,1)="A"
   thiscolor="RGB(0,128,192)"
  CASE SUBSTR(thiscell,1,1)="B"
   thiscolor="RGB(128,128,128)"
  OTHERWISE
   thiscolor="RGB(255,255,255)"
 ENDCASE 
 RETURN thiscolor
ENDFUNC
I'd like to use different colors for CUST_ID that begins with "A" & "B".
Appreciate your time.

Regards
Daniel
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform