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. CEdit control scroll bar problem

CEdit control scroll bar problem

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
3 Posts 2 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.
  • H Offline
    H Offline
    haritadala
    wrote on last edited by
    #1

    Hello all I've a CEdit control which has multiline and vscrollbar properties set. The problem I'm having is whenever the text exceeds the editbox size vertical scroll bar is not scrolling along with the text downwards. Instead I need to scroll the vertical bar manually to see what's there in the edit box. If anyone knows how to solve this problem, pls help me. Many thanks for your help. Hari.

    J 1 Reply Last reply
    0
    • H haritadala

      Hello all I've a CEdit control which has multiline and vscrollbar properties set. The problem I'm having is whenever the text exceeds the editbox size vertical scroll bar is not scrolling along with the text downwards. Instead I need to scroll the vertical bar manually to see what's there in the edit box. If anyone knows how to solve this problem, pls help me. Many thanks for your help. Hari.

      J Offline
      J Offline
      Johann Gerell
      wrote on last edited by
      #2

      You mean if you insert text programmatically, right? If so, then you must scroll the text manually after setting the caret at the end (no MFC here...):

      int textLength = ::GetWindowTextLength(hWndEdit);
      ::SendMessage(hWndEdit, EM_SETSEL, (WPARAM)textLength, (LPARAM)textLength);
      ::SendMessage(hWndEdit, EM_SCROLLCARET, (WPARAM)0, (LPARAM)0);

      -- Human beings, who are almost unique in having the ability
      to learn from the experience of others, are also remarkable
      for their apparent disinclination to do so. (Douglas Adams)

      H 1 Reply Last reply
      0
      • J Johann Gerell

        You mean if you insert text programmatically, right? If so, then you must scroll the text manually after setting the caret at the end (no MFC here...):

        int textLength = ::GetWindowTextLength(hWndEdit);
        ::SendMessage(hWndEdit, EM_SETSEL, (WPARAM)textLength, (LPARAM)textLength);
        ::SendMessage(hWndEdit, EM_SCROLLCARET, (WPARAM)0, (LPARAM)0);

        -- Human beings, who are almost unique in having the ability
        to learn from the experience of others, are also remarkable
        for their apparent disinclination to do so. (Douglas Adams)

        H Offline
        H Offline
        haritadala
        wrote on last edited by
        #3

        Hello Johann Thank you very much for the reply. Your code solved my problem. Thanks a lot. Hari.

        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