Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Coloring grids
Message
From
17/02/2006 13:10:46
 
 
To
17/02/2006 10:49:38
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01094787
Message ID:
01097134
Views:
16
Courtesy Cetin:
set safety off
CREATE TABLE employee (title c(20), birth_date D)
APPEND BLANK
REPLACE employee.title WITH "MANAGER"
REPLACE employee.birth_date WITH DATE()-10680
APPEND blank
REPLACE employee.title WITH "ASST"
REPLACE employee.birth_date WITH DATE()-9680
USE IN employee
Public oForm
oForm = Createobject("myForm")
oForm.Show()

Define Class myForm As Form
  DataSession = 2
  Height = 400
  Width = 600

  Add Object myGrid As Grid With ;
    Height = 400, Width = 600, RecordSource="employee"

  Procedure Load
    Use employee
  Endproc

  Procedure Init
    For Each oColumn In This.myGrid.Columns
      oColumn.DynamicBackColor = ;
        "thisform.MyColColor(["+oColumn.ControlSource+"])"
    Endfor
  Endproc

  Procedure myColColor
    Lparameters tcControlSource
    Local luValue, lnColor
    lnColor = 0xFFFFFF && default white
    luValue = Evaluate(m.tcControlSource)
    Do Case
      Case Lower(m.tcControlSource) = "employee.title"
        If Lower(m.luValue) = "sales manager"
          lnColor = Rgb(255,255,0)
        Endif
      Case Lower(m.tcControlSource) = "employee.birth_date"
        If Year(luValue) % 2 = 0
          lnColor = Rgb(0,255,255)
        Endif
    Endcase
    Return m.lnColor
  Endproc
Enddefine
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Reply
Map
View

Click here to load this message in the networking platform