How to control cell attributes from wxGridTableBase descendant?
I need to control cell attributes directly from successor of wxGridTableBase.
I override GetAttr method and experimenting with different return values of CanHaveAttributes method. Unsuccesfully.
control cell attributes from wxGridTableBase descendant Topic is solved
Code: Select all
wxGridCellAttr* DataTable::GetAttr(int row, int col)
{
if(col < tcivec.size())
{
return tcivec[col]->GetAttr();
}
return wxGridTableBase::GetAttr(row,col);
}
Which type of DataTable?phlox81 wrote:You need to create an wxGridCellAttr instance for each celltype, and return it.Code: Select all
wxGridCellAttr* DataTable::GetAttr(int row, int col) { if(col < tcivec.size()) { return tcivec[col]->GetAttr(); } return wxGridTableBase::GetAttr(row,col); }
wxGrid?
I understand that need to override GetAtrr method of wxGrid class instead of overrideing of GetAttr of wxGridTableBase class?
I don't which version of wx you are using. I am on 2.6.3 and there is a bug in the doc which says:return wxGridTableBase::GetAttr(row,col);
when in fact in the sources:wxGridCellAttr* GetAttr(int row, int col)
You need to use this last form.wxGridCellAttr* GetAttr(int row, int col, wxGridCellAttr::wxAttrKind kind)