It is possible to customize the style, font color, and background color of specific rows in a list box. To do this in an array based list box use the Row Style Array, Row Font Color Array, and Row Background Color Array from the Property List as shown:
All three arrays must be Longint type arrays. Each element in the arrays corresponds to a row in the list box, thus the arrays must be the same size as the arrays associated with the columns.
Below is an example of an array based list box that changes the style, font color, and background color of rows based on the data presented in the list box.
The following example populates the list box with peoples names along with their date of birth. If the person is under 21, the row is then highlighted and bolded.
C_LONGINT($numRecs_l) ALL RECORDS([People]) ORDER BY([People];[People]lastName;>;[People]firstName;>) $numRecs_l:=Records in selection([People]) ARRAY LONGINT(backgroundColor_al;$numRecs_l) ARRAY LONGINT(fontColor_al;$numRecs_l) ARRAY LONGINT(fontStyle_al;$numRecs_l) SELECTION TO ARRAY([People]lastName;lastNameCol_arr;[People]firstName;\ firstNameCol_arr;[People]dob;dobCol_arr) For ($i;1;$numRecs_l) If (calculateAge (dobCol_arr{$i}))<21) backgroundColor_al{$i}:=0x00FF0000 //red fontColor_al{$i}:=0x00FFFFFF //white fontStyle_al{$i}:=Bold Else backgroundColor_al{$i}:=0x00FFFFFF //white fontColor_al{$i}:=0x0000 //Black fontStyle_al{$i}:=Plain End if End for |