Can you set multiple wxGrid Colum Attributes?
Petr Smilauer
petrsm at jcu.cz
Fri Jan 11 01:47:11 PST 2008
Hello,
> I switched to this:
...
> wxColour default_cell_background_color =
> m_LogGrid->GetDefaultCellBackgroundColour();
> wxGridCellAttr *ColumnAttr = new wxGridCellAttr;// Remove all previous
> background colors, and set all of grid ReadOnly
>
> ColumnAttr->SetBackgroundColour( default_cell_background_color );
>
> ColumnAttr->SetReadOnly();
>
> m_LogGrid->SetColAttr( LogGridColDate, ColumnAttr );
>
> m_LogGrid->SetColAttr( LogGridColEventInHuman, ColumnAttr );
>
> m_LogGrid->SetColAttr( LogGridColEvent, ColumnAttr );
>
> which solved the ReadOnly problem, but did not solve
> the color problem.
Right, so you are doing both operations at the same time.
What does your "color problem" mean? You had these three columns
paint with background colours different from the others, and now you
want to return them to the default one?
I do not know why this does not work, it should. Isn't this just an
window refresh problem (have you tried to hide and uncover the
grid area)?
If not, I suggest you set breakpoint on one of these SetColAttr calls
and see whether they are replaced (down there in the
wxGridCellAttrProvider::SetColAttr function). Perhaps a deeper
understanding will make you change your current approach and
write your own attribute provider class ;-)
Perhaps, it would be also good to see what wxGrid::GetDefaultCellBackgroundColour
returns in that context.
Best regards from
Petr Smilauer
Ceske Budejovice
More information about the wx-users
mailing list