Board index » cppbuilder » Re: Subclass TStringGrid with two new properties
Re: Subclass TStringGrid with two new properties
2006-02-02 07:06:24 PM
Thanks again, I have added the properties for changing
rows and for changing cols... It works perfectly.
Last problem that I have is that when I create new
MyObject instances for Cells then for the Font and Color
variable I'm using the Grid's Font/Color values:
Cell *zelle = new Cell;
zelle->Font->Color = Font->Color; // Grid->Font->Color
zelle->Font->Height = Font->Height; // Grid->Font->Height
zelle->Font->Style = Font->Style; // and so on...
zelle->Font->Name = Font->Name;
zelle->Color = Color;
Objects[spalte][zeile] = reinterpret_cast<TObject*>(zelle);
This works great apart of one exception...
The constructor of the grid creates 5 rows and 5 cols by
default. At this point my Font and Color values for the grid
are not set yet.
My workaround is that I delete all cells with:
MyRowCount = 0;
set the font and color values of the grid
and then set MyRowCount again so that all cells are
filled with the right Font/Color values.
My question is, have you another idea or is it possible to
overwrite grid's constructor for creation of 0 rows and 0
Thanks for your time