VOTools for Visual Objects  
and Vulcan.NET  

bBrowser => Tips & Tricks => How to create a complex color condition with several colors    

 from bBrowser
  bBrowser 1.4 (Limited)

How to create a complex color condition with several colors

Based on the previous tip
     How to creates complex color conditions
the method can return a color array instead of a logical value. The color array must consist of the following items:

  auColorSpec [BCS_FOREGROUND]

All array elements that are empty, are filled with the foreground and background colors from the bColorCondition object.

The following code fragment demonstrates the proceeding:


METHOD PostInit() CLASS myDataWindow
  LOCAL odbsCUSTOMER     AS bDBServer
  LOCAL oColorCondition  AS bColorCondition

  IF odbsCUSTOMER:Used

    oColorCondition := bColorCondition{"Server:CheckCondition()",;


METHOD CheckCondition() CLASS myDataWindow
  LOCAL auColorSpec      AS ARRAY
  LOCAL iAge             AS INT

  odbsCUSTOMER := self:oDCBrowser:Server

  iAge := Year(Today())-Year(odbsCUSTOMER:BIRTHDAY)
  IF iAge>=40
    auColorSpec := ArrayCreate(BCS_ITEMS)
    auColorSpec[BCS_BACKGROUND] := Brush{Color{COLORRED}}

    RETURN auColorSpec
  ELSEIF iAge>=30
    auColorSpec := ArrayCreate(BCS_ITEMS)
    auColorSpec[BCS_BACKGROUND] := Brush{Color{COLORBLUE}}
    RETURN auColorSpec

Copyright © 2003-2015 BEFO GmbH