Kbase P170117: How to apply conditional formatting to UltraGrid rows at run time
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  13/12/2010 |
|
Status: Verified
GOAL:
How to apply conditional formatting to UltraGrid rows at run time
GOAL:
How to change the appearance of UltraGrid cells when their value changes
FACT(s) (Environment):
Windows
OpenEdge 10.2x
FIX:
While many features of the UltraGrid could be included under the heading of "conditional formatting", the InitializeRow event of the UltraGrid provides a convenient way to apply various kinds of formatting to individual cells or entire rows based on values of the cells in the row. InitializeRow fires for each row when the grid is loaded, and afterwards when values in the row change.
In the following example of an InitializeRow event handler, an UltraGrid displays the CreditLimit and Balance fields of the Sports2000 Customer table. Rows are colored red when the customer has a balance higher than the credit limit, and yellow when the balance is exactly at the credit limit:
METHOD PRIVATE VOID ultraGridCustomer_InitializeRow( INPUT sender AS System.Object, INPUT e AS Infragistics.Win.UltraWinGrid.InitializeRowEventArgs ):
IF DECIMAL(e:Row:Cells["Balance"]:Text) > DECIMAL(e:Row:Cells["CreditLimit"]:Text) THEN
e:Row:Appearance:BackColor = System.Drawing.Color:Red.
ELSE IF DECIMAL(e:Row:Cells["Balance"]:Text) = DECIMAL(e:Row:Cells["CreditLimit"]:Text) THEN
e:Row:Appearance:BackColor = System.Drawing.Color:Yellow.
RETURN.
END METHOD.