Items with Style

General TRichView support forum. Please post your questions here
Post Reply
Josip
Posts: 2
Joined: Fri Oct 11, 2013 8:18 am

Items with Style

Post by Josip »

How search for all items in RichViewEdit with Style 'myStyle'?

Josip
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

What do you want to do with these items?
(I am not sure how to show results)
Josip
Posts: 2
Joined: Fri Oct 11, 2013 8:18 am

Items with Style

Post 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 = ...
 }
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Post Reply