Page 1 of 1

Items with Style

Posted: Mon Oct 14, 2013 12:24 pm
by Josip
How search for all items in RichViewEdit with Style 'myStyle'?

Josip

Posted: Mon Oct 14, 2013 12:51 pm
by Sergey Tkachenko
What do you want to do with these items?
(I am not sure how to show results)

Items with Style

Posted: Mon Oct 14, 2013 1:22 pm
by Josip
Something like keywords in Help, maybe TStringList or ListBox

Code: Select all

 for (int i = 0; i < ActiveEditor->RichViewEdit->RVData->ItemCount ; i++)
 {
	 TFontInfo *fi = ...
 }

Posted: Tue Oct 15, 2013 2:13 pm
by Sergey Tkachenko
What do you mean by "with Style 'myStyle'"?

Below is the example how to add all text formatted with SRV->RichViewEdit->Style->TextStyles->Items[StyleNo] in ListBox1:

Code: Select all

void TForm1::EnumItems(TCustomRVData* RVData, int StyleNo)
{
  for (int i = 0; i< RVData->ItemCount; i++)
    if (RVData->GetItemStyle(i)==StyleNo)
      ListBox1->Items->Add(RVData->GetItemText(i));
    else if (RVData->GetItemStyle(i)==rvsTable)
    {
      TRVTableItemInfo* Table = (TRVTableItemInfo*)(RVData->GetItem(i));
      for (int r = 0; r < Table->RowCount; r++)
        for (int c = 0; c < Table->ColCount; c++)
          if (Table->Cells[r][c])
            EnumItems(Table->Cells[r][c]->GetRVData(), StyleNo);
    }
}
Call:

Code: Select all

EnumItems(SRV->RichViewEdit->RVData, StyleNo);
PS: I replied to your email, but it seems that your gmail account redirects to non-existent email address.