Kbase P71083: How to alternate the color of rows in a browse, by using CURRENT-RESULT-ROW?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  08/02/2005 |
|
Status: Unverified
GOAL:
How to alternate the color of rows in a browse, by using CURRENT-RESULT-ROW?
GOAL:
How to alternate the color of rows in a browse?
FACT(s) (Environment):
Progress 9
Progress 8
FIX:
The solution bellow achieves this in the ROW-DISPLAY Trigger. Relying on CURRENT-RESULT-ROW() is a good solution to display a particular record with the same color whatever its position is in the viewport.
Note that this technique does not work well when jumping to the end of a large set of records if the query is defined with the INDEXED-REPOSITION option (by pressing the END key for example), since CURRENT-RESULT-ROW() will return unknown.
ON ROW-DISPLAY OF myBrowse DO:
DEFINE VARIABLE ibgcolor AS INTEGER NO-UNDO.
ASSIGN
iBgColor = IF CURRENT-RESULT-ROW("myBrowse") MODULO 2 = 0 /*beware, myBrowse is actually the name of a query*/
THEN 11 /*light blue*/ ELSE ? /*default*/
customer.custnum:BGCOLOR IN BROWSE myBrowse = ibgcolor
customer.NAME:BGCOLOR IN BROWSE myBrowse = ibgcolor
customer.balance:BGCOLOR IN BROWSE myBrowse = ibgcolor.
END.
Note that BGCOLOR has to be assigned for each column of the browse to change the color of the whole row.
In version 9 and above, you can also use the CURRENT-RESULT-ROW query attribute rather than CURRENT-RESULT-ROW() function.