Page 1 of 1

Determining if TRichViewEdit is empty

Posted: Thu Nov 23, 2006 3:56 pm
by rtcary
Is there a property so one can tell if TRichViewEdit is empty? No characters present?

Thank you...

Posted: Thu Nov 23, 2006 5:20 pm
by mamouri
I think you can use RVGetTextRange of RVLinear unit like this:

if RVGetTextRange(RichView1, 0, RVGetTextLength(rv)) = '' then
...

Posted: Fri Nov 24, 2006 4:59 am
by shmp
Hi rtcary,

You may use rve.ItemCount to see if TRichViewEdit is really empty. This means nothing at all. If rve is cleard but not formated, the value returned is 0. If it is formatted, the value returned is 1.

Chao.

Re: Determining if TRichViewEdit is empty

Posted: Fri Nov 24, 2006 5:04 am
by Yernar Shambayev
rtcary wrote:Is there a property so one can tell if TRichViewEdit is empty? No characters present?

Thank you...

Code: Select all

function RVEmpty(MyRichView: TCustomRichView): Boolean;
begin
  Result := (MyRichView.ItemCount = 0) or ((MyRichView.ItemCount = 1) and
    (MyRichView.GetItemStyle(0) >= 0) and
    (MyRichView.GetItemText(0) = ''));
end;

Posted: Fri Nov 24, 2006 5:27 pm
by rtcary
Thank you! Works like a champ!

Todd