Forum: wxRuby Grid Cell Background Colour

E50d2ac925f5cf8403197c3cddd11d4b?d=identicon&s=25 Norbert Lange (lange_n)
on 2012-05-18 00:02
On to my next question.  :-)

I've been trying to get the cell background colour to work for a
Wx::Grid
control.  Setting a default background colour works, but using the
set_cell_background_colour method for an individual cell doesn't.
Following is a short snippet of what I'm trying to do (essentially
highlight cells that don't match):

  columnNames = Array.[]("Col1", "Col2", "Col3")
  row1 = Array.[]("A", "B", "C")
  row2 = Array.[]("X", "Y", "Z")
  resultSet = Array.[](row1, row2)

  table = Table.new(columnNames, resultSet)
  grid = Wx::Grid.new(panel, -1)
  grid.set_table(table)
  @grid.set_cell_background_colour(1, 1, Wx::RED)

Any help is greatly appreciated.

Norbert
E50d2ac925f5cf8403197c3cddd11d4b?d=identicon&s=25 Norbert Lange (lange_n)
on 2012-05-18 00:21
I should probably also have mentioned, the Table object is derived from
Wx::GridTableBase.
E50d2ac925f5cf8403197c3cddd11d4b?d=identicon&s=25 Norbert Lange (lange_n)
on 2012-05-18 19:15
Update:  I finally got this working.  In case anyone else runs into the
same thing, I finally realized I needed to override the set_attr and
get_attr methods in my Table subclass.

Norbert
This topic is locked and can not be replied to.