Paint listbox column

Is there any easy way to paint a listbox column without tagging cells? I am using the cell click command to get the column id so I can paint the entire column, now I just want to paint the clicked column.

Looking at man posts and docs all I see are row references for mass painting.

Thanks

In CellBackgroundPaint do a

if currentColumn = column then 'paint away else 'no paint for you lot end if

where currentColumn is your selected column.

and use the CELLCLICK event to “remember” what column you “selected”

FUNCTION CELLCLICK(row as integer,column as integer) as Boolean
dim x as integer
if column<>currentColumn then 
    x=currentColumn
    currentColumn=column
     me.invalidatecell(-1,x) //  UNPAINT the last selected column
     me.invalidatecell(-1,currentColumn) // PAINT the new column
end if
END FUNCTION



FUNCTION CELLBACKGROUNDPAINT(g as graphics,row as integer,column as integer) as boolean
if column=currentColumn then 
  g.forecolor=&cff0000
else
 g.forecolor=&cffffff
end if
g.fillrect 0,0,g.width,g.height
END FUNCTION

this assumes the currentCOLUMN has been defined as a “global” variable somewhere

This will paint the selected column RED (ff0000) and unselected columns WHITE (ffffff)

This is for example only :slight_smile:

Thanks I’ll try this!

INVALIDATECELL say "please redraw this cell … "
a ROW of -1 says “DO ALL THE ROWS for this COLUMN”
if you put -1 in the COLUMN it would be “DO ALL THE COLUMNS of this ROW”
if BOTH values are -1, this is says “REDRAW THE WHOLE DARN THING!”