vertically scolling rich edit

This is a discussion on vertically scolling rich edit within the Windows Programming forums, part of the Platform Specific Boards category; currently I am using EM_SETSEL/EM_REPLACESEL to add new lines to a rich edit control, the problem is when the text ...

  1. #1
    ENF
    ENF is offline
    Registered User
    Join Date
    Oct 2003
    Posts
    12

    vertically scolling rich edit

    currently I am using EM_SETSEL/EM_REPLACESEL to add new lines to a rich edit control, the problem is when the text is off the bottom of the scream the control dosen't scroll even though it has the WS_VSCROLL and ES_AUTOVSCROLL styles. What is the corect way to add a new line and make the control scroll if needed?

  2. #2
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Post your code. It works for me with an edit control.

    EDIT: It also works with a rich edit control for me.
    Last edited by bennyandthejets; 10-31-2003 at 05:46 AM.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  3. #3
    ENF
    ENF is offline
    Registered User
    Join Date
    Oct 2003
    Posts
    12
    Code:
    recv(Sock, RecvBuffer, DataLength, 0);
    				
    RecvBuffer[DataLength]=0; //make sure string is null terminated
    SendMessage(hEdit,  EM_SETSEL, -1, -1);
    SendMessage(hEdit, EM_REPLACESEL, 0, (LPARAM)RecvBuffer);
    //and add the new line characters		
    SendMessage(hEdit, EM_SETSEL, -1, -1);
    SendMessage(hEdit, EM_REPLACESEL, 0, (LPARAM)"\r\n");

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    You can also use EM_SCROLLCARET to scroll the selection into view.

  5. #5
    ENF
    ENF is offline
    Registered User
    Join Date
    Oct 2003
    Posts
    12
    Even after using EM_SCROLLCARET ater each selection I still have the same problem. I am wondering if it is something to do with the control not having focus., would that affect EM_SCROLLCARET? Also the messages are sent from a seperate thread but I don't think this would be a problem.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. line number on a rich edit control
    By rakan in forum Windows Programming
    Replies: 1
    Last Post: 02-18-2008, 06:58 AM
  2. can't disable ctrl-V on a rich edit control
    By rakan in forum Windows Programming
    Replies: 1
    Last Post: 02-06-2008, 07:37 AM
  3. rich edit 4.1 is giving me a head-ache
    By master5001 in forum Windows Programming
    Replies: 3
    Last Post: 07-01-2005, 01:21 PM
  4. How the rich get rich [Long]
    By nickname_changed in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 05-05-2005, 10:36 PM
  5. newbie to rich edit, cant get it to work
    By hanhao in forum Windows Programming
    Replies: 1
    Last Post: 03-24-2004, 09:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21