trichview.support
Re: Has a RichViewEdit content / text |
Author |
Message |
Sergey Tkachenko |
Posted: 10/15/2004 10:54:07 > I've tried the following code (C++): > > bool bEmpty; > > bEmpty = (RichViewEdit1->ItemCount == 0) || > ((RichViewEdit1->ItemCount == 1) && > (RichViewEdit1->GetItemStyle(0) == 0) && > (RichViewEdit1->GetItemText(0).Trim() == "") && > (RichViewEdit1->GetItemStyle(0) >= 0) && > (RichViewEdit1->GetItemPara(0) == 0)); > > > if(bEmpty == true) Caption = "RichViewEdit is empty"; > else Caption = "RichViewEdit isn't empty"; It's ok, but checking both for (RichViewEdit1->GetItemStyle(0) == 0) and (RichViewEdit1->GetItemStyle(0) >= 0) is redundant. > //--------- > > It doesn't work when I copy an Image, table and text from MS Word with CTRL+C > to RichViewEdit. And then delete the text from RichViewEdit. > > What I want is as follow: > > I want to save documents automatic. But I don't want to save empty documents. > With empty documents I mean: no visible text, images, tables, etc.. When you paste text from another editor, it is pasted with its font and paragraph attributes. If you delete this text, the attributes remain. The document is empty, but it's different from the initial empty document - when you start typing, text has different font, paragraph alignment may differ, etc. What's why the code above returns false. Ok, here is less strict checking: bEmpty = (RichViewEdit1->ItemCount == 0) || ((RichViewEdit1->ItemCount == 1) && (RichViewEdit1->GetItemStyle(0) >= 0) && (RichViewEdit1->GetItemText(0).Trim() == "")) |
Powered by ABC Amber Outlook Express Converter