trichview.support
Re: Counting images in TRichViewEdit |
Author |
Message |
Sergey Tkachenko |
Posted: 05/08/2005 22:47:45 Your code counts images in the top level editor. If the caret is inside table cell, it will count images in this table cell. General recursive procedure for item enumeration is shown in the help topic "Controls, Documents, Items" (AllUpperCase). But there is another way - using undocumented method EnumItems(). It calls the specified procedure for each item. void __fastcall TForm1::EnumPicsProc (TCustomRVData* RVData, int ItemNo, int&UserData1, const AnsiString UserData2, bool&ContinueEnum) { if (RVData->GetItemStyle(ItemNo)==rvsPicture || RVData->GetItemStyle(ItemNo)==rvsHotPicture) UserData1++; ContinueEnum=true; } void __fastcall TForm1::Button1Click(TObject *Sender) { int Count=0; RichViewEdit1->RVData->EnumItems(EnumPicsProc, Count, ""); Caption = IntToStr(Count); } |
Powered by ABC Amber Outlook Express Converter