Listbox Fill Full Row Color without gap

Platform : macOS Desktop

I tried a listbox with two columns and tried the following codes to do the alternative background color

if row mod 2 = 0 then
  g.drawingcolor = color.white
  g.FillRectangle(0,0,g.width,g.height)
else
  g.drawingcolor = &cEBECD300
  g.FillRectangle(0,0,g.width,g.height)
 end if 

It does the repainting but there seems to be a black gap between the columns which is more visible when in Dark Mode. Is there a way to remove that ?

Thanks

It looks like you have the drawing code in the PaintCellText event rather than the PaintCellBackground event.

1 Like

Oops you are right. I probably need some sleep. Thanks

Happy to help. Please remember to mark solutions to your questions/issues when they are solved to make it easier for others to see the solution.

I use the following code:

if row mod 2 = 0 then
  g.drawingcolor = color.white
else
  g.drawingcolor = &cEBECD300
end if 

g.FillRectangle(0,0,g.width,g.height)

or even:

g.drawingcolor =  if  (row mod 2 = 0, color.white, &cEBECD300)
g.FillRectangle (0, 0, g.width, g.height)
1 Like

Good performance, but less “readable” (for me).