Example 4: Set display attributes for cells

FUNCTION display_items()
   DEFINE i INTEGER
   DEFINE items DYNAMIC ARRAY OF RECORD
                key INTEGER,
                name CHAR(10)
              END RECORD
   DEFINE attributes DYNAMIC ARRAY OF RECORD
                key STRING,
                name STRING
              END RECORD

   FOR i=1 TO 10
     CALL items.appendElement()
     LET items[i].key = i 
     LET items[i].name = "name " || i 
     CALL attributes.appendElement()
     IF i MOD 2 = 0 THEN
       LET attributes[i].key = "red"
       LET attributes[i].name = "blue reverse"
     ELSE
       LET attributes[i].key = "green"
       LET attributes[i].name = "magenta reverse"
     END IF
   END FOR

   DISPLAY ARRAY items TO sr.* ATTRIBUTES(UNBUFFERED)
       BEFORE DISPLAY 
         CALL DIALOG.setCellAttributes(attributes)
       ON ACTION att_modify_cell 
         LET attributes[2].key = "red reverse"
       ON ACTION att_clear_cell 
         LET attributes[2].key = NULL
   END DISPLAY

END FUNCTION