Jump to content
  • Advertisement
Sign in to follow this  

Deleting the first X lines in a RichEdit

This topic is 4801 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm probably missing a blatently obvious message I can send here, but I can't find one to fit what I need. Is there a way to tell a RichEdit to delete the first X lines of a RichEdit? Or a EM_CHARFROMLINE message I can use to get a char index and erase that many chars? At the moment, the only way I can see to do this is to use EM_GETLINE to get line number x, then use EM_FINDTEXT on that returned string, then erase all chars from 0 to the return value of EM_FINDTEXT. But that seems way too backwards and hacky. So, is there anything to do what I need here, or will I have to stick to my horrible, hacky method?

Share this post


Link to post
Share on other sites
Advertisement
I haven't used RichEdit in a long time, but IIRC you can access it independent of "lines" (i.e. perform read/write operations on a selection of text, as defined by a starting and ending index). You could read from index 0 until you have found X line returns, then do a replace operation of that selection with ""

Share this post


Link to post
Share on other sites
Quote:
Original post by Michalson
I haven't used RichEdit in a long time, but IIRC you can access it independent of "lines" (i.e. perform read/write operations on a selection of text, as defined by a starting and ending index). You could read from index 0 until you have found X line returns, then do a replace operation of that selection with ""
Wouldn't using EM_FINDTEXT be just as fast? I think I'll go with that until I find a better method.
Most of the time I'll only be erasing 1 or 2 lines anyway.

EDIT: My method sucked. I'm reading 1 line at a time, and counting the number of chars in it to get a "char from line" indicator. That seems to work perfectly.
Thanks for the suggestion.

[Edited by - Evil Steve on March 29, 2005 10:00:59 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!