Thread: Appending to an edit control

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    30

    Appending to an edit control

    Whats the easiest and quickest way to append text to what is already in a Rich Edit control? When I open files, I open and read the file in another thread in 'chunks' of say, 1000 characters. Once each chunk has been read and stored in a temporary buffer, it needs to be appended to what has already been loaded in the edit control. Currently I am using a string to store all the text which has been loaded, and then using SetWindowText after reading each chunk to update the Edit control. But unfortunately this means the window flickers a lot and you can't scroll down and look through what has already been loaded.

    Since I'm using a Rich Edit control, I'm thinking of using the EM_SETTEXTEX message, or setting the selection to the end of the text and replacing the text there to effectively append it to the end... Are there any easier ways/better alternatives?

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Quote Originally Posted by TheDan
    Since I'm using a Rich Edit control, I'm thinking of using the EM_SETTEXTEX message, or setting the selection to the end of the text and replacing the text there to effectively append it to the end... Are there any easier ways/better alternatives?
    That's one way to do it. Set the start and end of the selection to -1.

    Another way is using Edit control Streams

  3. #3
    Registered User
    Join Date
    Apr 2005
    Posts
    30
    Ah thanks. I was hoping there'd be some easy way such as AppendWindowText or something ;D Replacing the selection at the end works great, but I might switch to streams to stop it scrolling like mad everytime it updates the text =(


    Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How can I send a text string to an edit control
    By marc74 in forum Windows Programming
    Replies: 5
    Last Post: 01-06-2005, 10:14 PM
  2. Appending text to an edit control
    By dit6a9 in forum Windows Programming
    Replies: 3
    Last Post: 08-13-2004, 09:52 PM
  3. Restricting input to an edit control
    By bennyandthejets in forum Windows Programming
    Replies: 7
    Last Post: 10-05-2003, 01:10 AM
  4. endless edit control
    By ZerOrDie in forum Windows Programming
    Replies: 3
    Last Post: 03-21-2003, 02:51 AM
  5. Keeping focus on an edit control ...
    By Unregistered in forum Windows Programming
    Replies: 3
    Last Post: 02-19-2002, 02:12 AM