Can you set multiple wxGrid Colum Attributes?

Bob wxwidgets at gmail.com
Thu Jan 10 09:20:52 PST 2008


On 1/9/08, Petr Smilauer <petrsm at jcu.cz> wrote:
>
>
> > the gird is ReadOnly as I want, but if I do try to set the background
> color
> > of the grid as well, then the grid is no longer read only.
>
> > Is it possible to set more than one attribute on a column?
> Yes, you can. But your ColorAttr object contains not only the background
> color settings, but also default settings for the other attributes,
> including
> read-only flag...



I switched to this:

wxColour default_cell_background_color =3D
m_LogGrid->GetDefaultCellBackgroundColour();

wxGridCellAttr *ColumnAttr =3D 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.


>
> What about
> m_logGrid->GetTable()->SetAttrProvider( new wxGridCellAttrProvider);



This did reset all of the colors to the default, thank you.

I still do not understand why the way I was tring to reset
the default color does not work?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-users/attachments/20080110/f8b=
14b15/attachment.htm


More information about the wx-users mailing list