I've my grid class, that works fine and use its own styles. I want to insert that grid in a TRichViewEdit component. All's ok for cell text and borders but i can't set font styles (name, size...) and text alignment.
I convert my styles to TFontInfo and add it to TRVStyle:
int AddStyle(TRVStyle *rvs, TFontInfo *pFontInfo)
{
rvs->TextStyles->Add();
int NewStyleNo = rvs->TextStyles->Count - 1;
rvs->TextStyles->Items[NewStyleNo]->Assign(pFontInfo);
rvs->TextStyles->Items[NewStyleNo]->Standard = false;
return NewStyleNo;
}
[/quote]
In my style objects, i store the returned NewStyleNo into an UserData integer, to use it when i later add cells from my grid to TRichView:
[code]
if(TRVTableCellData *pCell = pTable->Cells[r][c])
{
clsString sText = "some text";
if(TLigsStyle *pStyle = ligsprinter->GetStyleP(sStyle))
{
pCell->GetTable()->AssociatedTextStyleNo = pStyle->UserData;
}
pCell->SetItemText(0, CS(sText));
}
The problem seems to be in GetTable()->AssociatedTextStyleNo that seems to do nothing or maybe i've not undesrtood how styles works, in TRichViewEdit?
I have to do it for any cell in the grid. If i only add text, the grid would be created almost instantly, if i set text/para style it requires 8 seconds for a 30 rows x 10 columns table.
There is a way to speed up apply text/para styles?
for (int r = 0; r<pTable->RowCount; r++)
for (int c = 0; c<pTable->ColCount; c++)
{
pTable->Cells[r][c]->Clear();
pTable->Cells[r][c]->AddNL('', textStyleNo, paraStyleNo);
}
As for AssociatedTextStyleNo, this property is implemented only in items that are linked to text style, i.e. in tabs and labels. This property is for internal use.