listbox cell background

Hello,

my listbox compiled on windows does only change the background for the column 2, not for the complete row, on Mac it changes the complete row (what I want).
Why?

if Me.CellTag(row, 1)="bg" then g.ForeColor = app.listboxMouseOver g.FillRect(0, 0, g.Width, g.Height) me.Invalidate end if

FWIW dont invalidate IN a paint event like cell background paint etc
just paint and move on
make sure you return true or false as appropriate

Because

if Me.CellTag(row, 1)="bg" then

only checks the CellTag in column 1 so it only sets the color for that column. A better way would be to check the celltag to set the color and move the fillRect outside of the conditional. Somcething like

if Me.CellTag(row, 1)="bg" then g.ForeColor = app.listboxMouseOver end if g.FillRect(0, 0, g.Width, g.Height)
and be sure to restore the normal fill color afterwards.

[quote=492052:@Dale Arends]Because

if Me.CellTag(row, 1)="bg" then

only checks the CellTag in column 1 so it only sets the color for that column.[/quote]
I’m pretty sure OP is using that right. It’s a flag to color the row, it doesn’t need to check every column just where the flag would be stored for that row. Should column 1 have the value “bg” it would evaluate true for every cell on the row. That should color the whole row.

My guess is that there’s conflicting code elsewhere and that one of the platforms is just showing the system level drawing inconsistencies.

[quote=492055:@Tim Parnell]I’m pretty sure OP is using that right. It’s a flag to color the row, it doesn’t need to check every column just where the flag would be stored for that row. Should column 1 have the value “bg” it would evaluate true for every cell on the row. That should color the whole row.
[/quote]

Though unless he is using the RowTag for something else, the code would be more readable/intuitive if he used that instead of a CellTag for intimated the row color.