CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    use CRichEditCtrl as text output

    Hi world,
    I want to use a multiline CRichEditCtrl control with vertical scrolling as an output field for messages to the user (similar to the message window at the bottom a Visual Studio). I have set the field to be read only, but I have not found a straightforward way to append the existing text lines with new additional text. Currently I use:

    int num = my_ctrl->GetWindowTextLength();
    my_ctrl->SetSel(num, num);
    my_ctrl->ReplaceSel(new_message);

    Is there a more convenient way to append the existing text? How can I make the CRichEdit control scroll to the end each time new text is added (like the one in Visual Studio does)?
    If I use CEdit instead of CRichEditCtrl, it scrolls to the tzext end automatically when the above code is called - but the CRichEditCtrl remains at the top of the text...

    Jens
    [email protected]



  2. #2
    Join Date
    May 1999
    Location
    Toulouse, France
    Posts
    171

    Re: use CRichEditCtrl as text output

    Try my_ctrl.SetSel(-1, -1) instead of (num, num).

    HTH

    K.

    Ash to ash and clay to clay, if the enemy doesn't get you, your own folk may.
    We're talking ****, 'cause life is a 'biz
    You know it is
    Everybody tryin' to get rich
    God ****!
    All I wanna do is live !

    KoRn, Children of the Korn

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured