Setting BackGroundColor in a List

I have defined an array of checkbox Lists in an application, with a default style for “selectBackgroundColor” (a lovely purple). So, as an example, one list is

checkBoxList[“Projects”]

and to check the third item in the list, I use:

checkBoxList["Projects"].setCheck(2, true);

which then turns purple.

But there are some cases where I want to set the BackgroundColor to, let’s say, yellow.

Is this doable, and if so, what be the syntax?

well.. sort of. It does not have a roll color like the others and is sort of a cludge.

Not sure how to make use of your example: Your approach works because you take advantage of a change to the list item (assuming a user did the clicking), which triggers a “selected” state. In my use, all the activity is done “manually”, i.e., an item is “checked” based on whether the day is a particular day of the week or of a month. For example:

if (dayOfWeek == 3) {checkBoxList["Projects"].setCheck(2, true);}

Not sure, then, how to get “selected”.

Oh - I see, right - you can use:

list.items[2].backing.color = pink;
list.items[2].backing.cache();

The cache() prevents it from being changed by the list behavior. If you ever want it to change then use uncache().

Pink it is! Thanks.

1 Like