Thank you Razzak. What you've described has kicked-started my memory cell and sounds familiar. I've printed your email and will take it with me out of town tonight & try it. I'll also check the 2008 SATs for details. I can use both of your scenarios below.
Doug

A. Razzak Memon wrote:

At 01:39 PM 10/9/2008, Doug Hamilton wrote:

I want to specify row colors based on values in a specific
column and think I remember seeing it done. I've run the
DBGridBGColor_Font form in the DBGridBC database in the
2008 RBG76 SAT that changes row colors based on row info.
But I can't find any code, properties or variables that
accomplish the color changes.

Can somebody point me in the right direction?


Doug,

Once you have added the required two columns in a desired
table, (for example: RowBackgroundColor TEXT (20) for row
background color, and RowFontColor TEXT (20) for row font
color), you can achieve your goal using the following two
techniques when displaying the DB Grid:

Of course, you also need to associate both column names
required when defining Row Background Color Field and
Row Font Color Field under "Effects" section of DB Grid
properties.

01. Before using the "EDIT/BROWSE USING formname" command,
    update the last saved values for RowBackgroundColor
    and RowFontColor to NULL.

    Now use your logic of defining background color and
    appropriate font color for each row (record) for the
    table associated with DB Grid.

    Example:

    UPDATE EmployeeRecords SET +
    RowBackgroundColor = 'RED' +
    RowFontColor = 'WHITE' +
    WHERE JobPerformance = 'Poor'

    UPDATE EmployeeRecords SET +
    RowBackgroundColor = 'YELLOW' +
    RowFontColor = 'BLACK' +
    WHERE JobPerformance = 'Average'

    UPDATE EmployeeRecords SET +
    RowBackgroundColor = 'GREEN' +
    RowFontColor = 'WHITE' +
    WHERE JobPerformance = 'Good'

    EDIT USING PerformanceHistory ORDER BY EmpLastName

    Notice the conditional

02. Use the power and cool feature of defining Form Timer
    to dynamically refresh the row color, if someone else
    changing the value in a multi-user network environment.

    Example:

    First "Enable" the option for Timer and set the timer
    value to 10000.

    Use the following code as Custom EEP for timer.

    -- Start
    -- Form Timer EEP
    PROPERTY DBGridBGColor_Font|TABLE EmployeeRecords REFRESH
    PROPERTY DBGridBGColor_Font|DBGrid REPAINTGRID 'TRUE'
    RETURN
    -- End

    Where: "DBGrid" is the Component ID for DB Grid control.

More detailed and practically used application is also included
on your 2008 SAT sample applications.

Folders:
    \2008_RBG76_SAT\UsingFormTimerProperties
    \2008_RBG8_SAT\UsingFormTimerProperties
Database:
    FrmTimer
Associated Forms:
    FormTimerDBGrid01
    FormTimerDBGrid02
Command File:
    UsingFormTimerProperties.DAT

Updated versions of all 2008 SAT Applications are available at:
http://www.rupdates.com/sat2008

Have fun!

Very Best R:egards,

Razzak.





Reply via email to