| Author | Topic: Problems with xbpBrowse - row colouring | |
|---|---|---|
![]() | Salar Madadi | Problems with xbpBrowse - row colouring on Tue, 24 Apr 2012 17:21:21 -0400 Hello, We are having a problem with the implementation of row colouring in the xbpBrowse object. We have row colouring that is determined by examining the data in a row and running some complex calculations to determine what colouring should be applied to that row. To prevent the calculation from having to be run once for every cell in every row, I've created a couple of different code blocks that get used as the color block in the xbpColumn objects. The first code block is always placed in the first column on the left and evaluates an expression to determine what colour that row should be assigned, then stores that result in a variable. The second code block is used as the color block in all the other columns, and it simply refers to the variable that was calculated in the first code block in the first column. So instead of running 10 times if there are 10 columns, the expression runs once and the result is used 10 times. An example of this is shown in the attached screenshot: working.jpg - with rows where the Type column is "USER" set to green. Our problem arises when we freeze some of the columns on the left side of the browse. When we do this, it seems to change the order that the columns are refreshed in - so the first non-frozen column is refreshed first, then proceeding to the last non-frozen column, then proceeding to the frozen columns. This causes a problem with our code as the code block that evaluates the colour for the row is not run until the majority of the columns in that row have already been refreshed, and then the next row has it's colours set using the colouring from the previous row. An example of this is shown in the attached screenshot: not-working.jpg. Is there any way to set an expression to evaluate to colouring to be used in a row in a browse without requiring that the expression is run in every single column? It seems very inefficient that we are forced to evaluate the expression for the row colouring for every single column / cell. Is there any way to ensure that the frozen columns get refreshed first, then the non-frozen columns get refreshed? Thanks, Salar Madadi - Latest Developments Inc. working.jpg not-working.jpg |
![]() | AUGE_ OHR | Re: Problems with xbpBrowse - row colouring on Wed, 25 Apr 2012 00:07:58 +0200 hi, >Is there any way to set an expression to evaluate to colouring to be used >in a row in a browse without requiring that the expression is run in every >single column? It seems very inefficient that we are forced to evaluate >the expression for the row colouring for every single column / cell. if you want to have Control when "paint" a Cell you have to use Ownerdraw ( o:customDrawCell ) it will pass 2 parameter, oPS and aInfo, but you can add more e.g. a Array, Codeblock etc. aInfo Array does have XBP_DRAWINFO_ITEM which is your Row and XBP_DRAWINFO_COLUMN will give you the Colume where Xbase++ want to do something ( paint Cell ) greetings by OHR Jimmy |
![]() | Salar Madadi | Re: Problems with xbpBrowse - row colouring on Wed, 25 Apr 2012 10:27:39 -0400 Jimmy, Thanks, I will look into that. Salar Madadi - Latest Developments inc. <AUGE_ OHR> wrote in message news:5028f9c7$5114566$3988e@news.alaska-software.com... > hi, > >>Is there any way to set an expression to evaluate to colouring to be used >>in a row in a browse without requiring that the expression is run in every >>single column? It seems very inefficient that we are forced to evaluate >>the expression for the row colouring for every single column / cell. > > if you want to have Control when "paint" a Cell you have to use Ownerdraw > ( o:customDrawCell ) > it will pass 2 parameter, oPS and aInfo, but you can add more e.g. a > Array, Codeblock etc. > > aInfo Array does have XBP_DRAWINFO_ITEM which is your Row and > XBP_DRAWINFO_COLUMN > will give you the Colume where Xbase++ want to do something ( paint Cell ) > > greetings by OHR > Jimmy |
![]() | James Loughner | Re: Problems with xbpBrowse - row colouring on Wed, 25 Apr 2012 00:14:03 -0400 Something Like this
Function SetColor()
STATIC LastRec := 0 , cHue := {basecolorFG,baseColorBG}
IF RECNO() != LASTREC
LastRec := RECNO()
cHue := Calculation()
Endif
RETURN cHue
Calculation on happens on first column of each record
Jim
On 04/24/2012 05:21 PM, Salar Madadi wrote:
> Hello,
>
> We are having a problem with the implementation of row colouring in the
> xbpBrowse object. We have row colouring that is determined by examining the
> data in a row and running some complex calculations to determine what
> colouring should be applied to that row. To prevent the calculation from
> having to be run once for every cell in every row, I've created a couple of
> different code blocks that get used as the color block in the xbpColumn
> objects.
>
> The first code block is always placed in the first column on the left and
> evaluates an expression to determine what colour that row should be
> assigned, then stores that result in a variable. The second code block is
> used as the color block in all the other columns, and it simply refers to
> the variable that was calculated in the first code block in the first
> column. So instead of running 10 times if there are 10 columns, the
> expression runs once and the result is used 10 times.
>
> An example of this is shown in the attached screenshot: working.jpg - with
> rows where the Type column is "USER" set to green.
>
> Our problem arises when we freeze some of the columns on the left side of
> the browse. When we do this, it seems to change the order that the columns
> are refreshed in - so the first non-frozen column is refreshed first, then
> proceeding to the last non-frozen column, then proceeding to the frozen
> columns. This causes a problem with our code as the code block that
> evaluates the colour for the row is not run until the majority of the
> columns in that row have already been refreshed, and then the next row has
> it's colours set using the colouring from the previous row.
>
> An example of this is shown in the attached screenshot: not-working.jpg.
>
> Is there any way to set an expression to evaluate to colouring to be used in
> a row in a browse without requiring that the expression is run in every
> single column? It seems very inefficient that we are forced to evaluate the
> expression for the row colouring for every single column / cell.
>
> Is there any way to ensure that the frozen columns get refreshed first, then
> the non-frozen columns get refreshed?
>
> Thanks,
>
> Salar Madadi
> - Latest Developments Inc.
>
>
>
>
> |



