Determining if TRichViewEdit is empty

General TRichView support forum. Please post your questions here
Post Reply
rtcary
Posts: 12
Joined: Sun Apr 16, 2006 4:03 am

Determining if TRichViewEdit is empty

Post by rtcary »

Is there a property so one can tell if TRichViewEdit is empty? No characters present?

Thank you...
mamouri
Posts: 63
Joined: Sat Aug 19, 2006 5:06 am

Post by mamouri »

I think you can use RVGetTextRange of RVLinear unit like this:

if RVGetTextRange(RichView1, 0, RVGetTextLength(rv)) = '' then
...
shmp
Posts: 140
Joined: Sun Aug 28, 2005 10:19 am
Location: Sabah, Malaysia.
Contact:

Post 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.
Yernar Shambayev
Posts: 57
Joined: Wed Aug 31, 2005 6:46 pm

Re: Determining if TRichViewEdit is empty

Post 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;
rtcary
Posts: 12
Joined: Sun Apr 16, 2006 4:03 am

Post by rtcary »

Thank you! Works like a champ!

Todd
Post Reply