How to creates color conditions

Requirement: bBrowser 1.4

 

With the class bColorCondition color conditions can be defined in the bBrowser. A color condition consists of a condition and one or more foreground and/or background colours. For a color condition a data server can be specified, whose fields in the condition can be accessed. Color conditions can be added either to the bBrowser or to each column. If the color condition is added to the bBrowser, then it refers to all columns. If the color condition is added to a column, then it refers only to this column. The number of color conditions are subject to none restriction.

With the instruction bBrowser:ColorCondition:Add() a color condition can be added to a bBrowser. With the instruction bDataColumn:ColorCondition:Add() a color condition can be added to a column. In both cases the methods bBrowser:Refresh() and bBrowser:Redraw() must be called afterwards.

The following code fragment defines a color condition for all columns in the bBrowser.

METHOD PostInit() CLASS myDataWindow

  LOCAL odbsCUSTOMER    AS bDBServer

  LOCAL oColorCondition AS bColorCondition

  LOCAL cCondition      AS STRING

 

  odbsCUSTOMER := bDBServer{"CUSTOMER.DBF"}

  IF odbsCUSTOMER:Used

    self:oDCBrowser:Use(odbsCUSTOMER)

 

    cCondition := "Year(Today())-Year(Server:BIRTHDAY)>=40"

    oColorCondition := bColorCondition{cCondition;

                                       odbsCUSTOMER,;

                                       Color{COLORYELLOW},;

                                       Brush{Color{COLORRED}}}

    self:oDCBrowser:ColorCondition:Add(oColorCondition)

 

    self:oDCBrowser:Refresh()

    self:oDCBrowser:Redraw()

  ENDIF