• Welcome to Valhalla Legends Archive.
 

rtb Text Removal

Started by Lenny, March 03, 2004, 02:31 PM

Previous topic - Next topic

Lenny

To minimize memory usage, I need to have a rich text box remove the oldest lines of text (top lines).

I have been told there is a SendMessage api call that will do this, Ive tried searching for it on google but have found nothing...Does anyone know if this is even exists?
The Bovine Revolution
Something unimportant

Live Battle.net:

WARNING: The preceding message may have contained content unsuitable for young children.

Grok

Yes.  Select the text you want to delete.  Set it to empty string.


   rtb.SelStart = 1
   rtb.SelLength = InStr(rtb.Text, vbCrLf)
   rtb.SelText = ""


You can keep a line counter in your AddChat for whenever you add text.  If that count is greater than the number of lines you want to keep, call the delete line code above and decrement the line count.

Lenny

Anyone know the arguments to send to the "SendMessage" for highlighting text?

I haven't tested the code Grok posted yet but wouldnt

   rtb.SelStart = 1

move the rtbscroll up also?
The Bovine Revolution
Something unimportant

Live Battle.net:

WARNING: The preceding message may have contained content unsuitable for young children.

Grok

After you have deleted the lines, you put SelStart back to Len(rtb.Text)

Lenny

The switchting from rtb.SelStart = 1 to rtb.SelStart = Len(rtb.Text) causes a flicker to occur at every add becuase of it moving back in forth...

Is there any other way to remove the text?  As I said, there's a rumored SendMessage for the rtb to remove text that I cant seem to find...
The Bovine Revolution
Something unimportant

Live Battle.net:

WARNING: The preceding message may have contained content unsuitable for young children.

Grok

I'm not familiar with that EM_whatever message for RichEdit boxes.  Maybe something new in RichEdit 3.0?

Anyway, you can try locking window updates before removing the lines, then unlocking after you reposition the caret.