Making a listbox row a color

I have read the Xojo docs, and can’t figure this out, if its possible.

I need to color a certain row in a Listbox (the color yellow actually). Is there an easy way to do this?

For desktop check the cellPaint event

cell background is probably the one you want

what I’ve done is just set a row tag on the rows I want specially colored then the events can check that to see how or if they should color themselves

I read the wiki, makes no sense really for what i want to do.

I’m working with Listbox2, and if the variable Primary = 1, then set the first row of Listbox2 to Yellow.
If Primary = 2 then set the second row of ListBox2 to Yellow, etc.

How would I do this in code? I assume its CellBackgroundPaint?

Yes, in CellBackgroundPaint:

If row = Primary then g.forecolor = &cFFFF0000 g.FillRect 0,0 g.width, g.height Return True End if

[quote=134555:@Karen Atkocius]Yes, in CellBackgroundPaint:

If row = Primary then g.forecolor = &cFFFF0000 g.FillRect 0,0 g.width, g.height Return True End if[/quote]

just change the IF statement to whatever is appropriate for your app. You can also do an IF…ELSEIF…THEN statement and have multiple colors. Like Red/Yellow/Green for status colors.

Karen’s answer is the most direct.