How to define the selection colors for color conditions

Requirement: bBrowser 1.4

 

In the class bColorCondition the following accesses are defined:

  • SelectedBackground
  • SelectedForeground
  • InactiveSelectedBackground
  • InactiveSelectedForeground

With these accesses the foreground and background colors can be defined, which are to be used, if the color condition applies to a cell and the cell is selected.

The following code fragment demonstrates the proceeding:

METHOD PostInit() CLASS myDataWindow

  LOCAL odbsCUSTOMER   AS bDBServer

  LOCAL oCC            AS bColorCondition

  LOCAL cCondition     AS STRING

 

  odbsCUSTOMER := bDBServer{"CUSTOMER.DBF"}

  IF odbsCUSTOMER:Used

    self:oDCBrowser:Use(odbsCUSTOMER)

 

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

    oCC := bColorCondition{cCondition,;

                           odbsCUSTOMER,;

                           Color{COLORYELLOW},;

                           Brush{Color{COLORRED}}}

    oCC:SelectedForeground := Color{COLORYELLOW}

    oCC:InactiveSelectedForeground := Color{COLORYELLOW}

 

    self:oDCBrowser:ColorCondition:Add(oCC)

    self:oDCBrowser:Refresh()

    self:oDCBrowser:Redraw()

  ENDIF