Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to make my rich edit ctrl scroll automatically when insert new text?

how to make my rich edit ctrl scroll automatically when insert new text?

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++tutoriallearning
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    awah
    wrote on last edited by
    #1

    how to make my rich edit ctrl scroll automatically when insert new text? here's how i insert text msg.Insert( msg.GetLength() , "\n"); m_system_message.SetSel(-1,-1); m_system_message.ReplaceSel(msg); here's how the richedit is defined in the resource file CONTROL "",IDC_SYSTEM_MESSAGE,"RICHEDIT",ES_MULTILINE | ES_AUTOVSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP,11, 257,241,52 as you guys can see, ES_AUTOVSCROLL is definately there but whenever i insert new text using ReplaceSel, the text focus is always at the top. how do i make it such that it automatically scrolls down to read the latest text inserted? using - mfc - vc6.0 - winxp thanks in advance!

    H K 2 Replies Last reply
    0
    • A awah

      how to make my rich edit ctrl scroll automatically when insert new text? here's how i insert text msg.Insert( msg.GetLength() , "\n"); m_system_message.SetSel(-1,-1); m_system_message.ReplaceSel(msg); here's how the richedit is defined in the resource file CONTROL "",IDC_SYSTEM_MESSAGE,"RICHEDIT",ES_MULTILINE | ES_AUTOVSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP,11, 257,241,52 as you guys can see, ES_AUTOVSCROLL is definately there but whenever i insert new text using ReplaceSel, the text focus is always at the top. how do i make it such that it automatically scrolls down to read the latest text inserted? using - mfc - vc6.0 - winxp thanks in advance!

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      Im not sure see A Rich Edit Control That Displays Bitmaps and Other OLE Objects[^] does helpful?


      WhiteSky


      1 Reply Last reply
      0
      • A awah

        how to make my rich edit ctrl scroll automatically when insert new text? here's how i insert text msg.Insert( msg.GetLength() , "\n"); m_system_message.SetSel(-1,-1); m_system_message.ReplaceSel(msg); here's how the richedit is defined in the resource file CONTROL "",IDC_SYSTEM_MESSAGE,"RICHEDIT",ES_MULTILINE | ES_AUTOVSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP,11, 257,241,52 as you guys can see, ES_AUTOVSCROLL is definately there but whenever i insert new text using ReplaceSel, the text focus is always at the top. how do i make it such that it automatically scrolls down to read the latest text inserted? using - mfc - vc6.0 - winxp thanks in advance!

        K Offline
        K Offline
        khan
        wrote on last edited by
        #3

        I think ES_AUTOVSCROLL is there to help scroll the window when the user inputs text using the keyboard etc. But for automatic additions to the control, I think you could send it a message to scroll itself after adding text to it. //Add text to it here. m_system_message.SendMessage(WM_VSCROLL,MAKEWPARAM(SB_BOTTOM,0)); Then it should scroll to the bottom, and the cursor, if in it, should appear at the end of the last line.

        this is this.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups