Change color selected cell

Hi All,

I need to change the back color of a cell when the user selects the cell. I have a listbox with one row and 12 cells. User must be able to select one or more cells.
changing the back color will indicate the selection.

Any ideas?

[quote=139525:@A Himmit]Hi All,

I need to change the back color of a cell when the user selects the cell. I have a listbox with one row and 12 cells. User must be able to select one or more cells.
changing the back color will indicate the selection.[/quote]

I suppose you are referring to a listbox. See the CellBackgroungPaint event, where you can use graphics.fillrect to put the color. http://documentation.xojo.com/index.php/ListBox.CellBackgroundPaint

Hi Michel,

Yes I know about the listbox.CellBackgroundPaint event. But I need to know which cell has been selected by the user. I don’t want to change the back ground color of the other cells that have not been selected.

Thanks,

This could be useful:
http://documentation.xojo.com/index.php/ListBox.CellClick

You could use the event here and pass it to cellbackgroundpaint?

Try this:

If Me.Selected(row) Then g.ForeColor = RGB(250,250,250) end If

Hope that helps.

[quote=139581:@Richard Summers]Try this:

If Me.Selected(row) Then g.ForeColor = RGB(250,250,250) end If

Hope that helps.[/quote]

Won’t that color the entire row?

something like this?
Download

I think that you can select multiple rows but not multiple cells.

Use the celltag to hold a ‘selected’ flag and color the cell based on the state of that flag?

Thanks, Axel…that’s a keeper! :slight_smile: