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 the cursor move to end of a multiline edit box ?

How to make the cursor move to end of a multiline edit box ?

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
10 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.
  • K Offline
    K Offline
    kapardhi
    wrote on last edited by
    #1

    Hai! I have a multiline edit box in my MFC application , it is also enabled with auto V-Scroll, after all the data is being displayed, it goes to the initial position, i have to scroll to the end, for data verification, is there any way to make the cursor to stay at the end or last position after printing all the data ? Thankyou !

    N F 2 Replies Last reply
    0
    • K kapardhi

      Hai! I have a multiline edit box in my MFC application , it is also enabled with auto V-Scroll, after all the data is being displayed, it goes to the initial position, i have to scroll to the end, for data verification, is there any way to make the cursor to stay at the end or last position after printing all the data ? Thankyou !

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      kapardhi wrote:

      I have a multiline edit box in my MFC application , it is also enabled with auto V-Scroll, after all the data is being displayed, it goes to the initial position, i have to scroll to the end, for data verification, is there any way to make the cursor to stay at the end or last position after printing all the data ?

      Do this... extern CEdit* pEdit; // Some edit pEdit.SetSel( 0, -1 ); // Move cursor to end pEdit.SetSel( -1, -1 ); // Remove selection

      Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

      K 1 Reply Last reply
      0
      • K kapardhi

        Hai! I have a multiline edit box in my MFC application , it is also enabled with auto V-Scroll, after all the data is being displayed, it goes to the initial position, i have to scroll to the end, for data verification, is there any way to make the cursor to stay at the end or last position after printing all the data ? Thankyou !

        F Offline
        F Offline
        fantasy1215
        wrote on last edited by
        #3

        Use CEdit::LineScroll m_ctlEdit.LineScroll (m_ctlEdit.GetLineCount());

        K 1 Reply Last reply
        0
        • F fantasy1215

          Use CEdit::LineScroll m_ctlEdit.LineScroll (m_ctlEdit.GetLineCount());

          K Offline
          K Offline
          kapardhi
          wrote on last edited by
          #4

          Hello! what is happening is each time the data is entered into the multiline edit box the scroll bar goes to initial position and then comes down, it appears like blinking, what i need is it must go down first and then decrease the size of scrollbar and stay at the end when data printed on the multiline edit box is completed! thanks!

          1 Reply Last reply
          0
          • N Nibu babu thomas

            kapardhi wrote:

            I have a multiline edit box in my MFC application , it is also enabled with auto V-Scroll, after all the data is being displayed, it goes to the initial position, i have to scroll to the end, for data verification, is there any way to make the cursor to stay at the end or last position after printing all the data ?

            Do this... extern CEdit* pEdit; // Some edit pEdit.SetSel( 0, -1 ); // Move cursor to end pEdit.SetSel( -1, -1 ); // Remove selection

            Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

            K Offline
            K Offline
            kapardhi
            wrote on last edited by
            #5

            hello ! what is happening is each time the data is entered into the multiline edit box the scroll bar goes to initial position and then comes down, it appears like blinking, what i need is it must go down first and then decrease the size of scrollbar and stay at the end when data printed on the multiline edit box is completed! thanks!

            N 1 Reply Last reply
            0
            • K kapardhi

              hello ! what is happening is each time the data is entered into the multiline edit box the scroll bar goes to initial position and then comes down, it appears like blinking, what i need is it must go down first and then decrease the size of scrollbar and stay at the end when data printed on the multiline edit box is completed! thanks!

              N Offline
              N Offline
              Nibu babu thomas
              wrote on last edited by
              #6

              kapardhi wrote:

              what is happening is each time the data is entered into the multiline edit box the scroll bar goes to initial position and then comes down, it appears like blinking,

              Can you try EM_REPLACESEL. Something like...

              pEdit->SendMessage( EM_REPLACESEL,
              TRUE,
              (LPARAM)static_cast<LPCTSTR>( csTextToBeInserted ));

              Tell us if the blinking problem does get solved.

              Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

              modified on Wednesday, November 26, 2008 7:55 AM

              K 2 Replies Last reply
              0
              • N Nibu babu thomas

                kapardhi wrote:

                what is happening is each time the data is entered into the multiline edit box the scroll bar goes to initial position and then comes down, it appears like blinking,

                Can you try EM_REPLACESEL. Something like...

                pEdit->SendMessage( EM_REPLACESEL,
                TRUE,
                (LPARAM)static_cast<LPCTSTR>( csTextToBeInserted ));

                Tell us if the blinking problem does get solved.

                Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

                modified on Wednesday, November 26, 2008 7:55 AM

                K Offline
                K Offline
                kapardhi
                wrote on last edited by
                #7

                I couldnot compile it my CEdit object is edtObj. i did the following CString str; str = "Kaps"; edtObj.SendMessage (EM_REPLACESEL, TRUE, (LPARAM) static_cast (str)); it was giving following error syntax error : '('

                N 1 Reply Last reply
                0
                • K kapardhi

                  I couldnot compile it my CEdit object is edtObj. i did the following CString str; str = "Kaps"; edtObj.SendMessage (EM_REPLACESEL, TRUE, (LPARAM) static_cast (str)); it was giving following error syntax error : '('

                  N Offline
                  N Offline
                  Nibu babu thomas
                  wrote on last edited by
                  #8

                  kapardhi wrote:

                  edtObj.SendMessage (EM_REPLACESEL, TRUE, (LPARAM) static_cast (str));

                  Sorry for that, I've modified my previous post, please check.

                  Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

                  1 Reply Last reply
                  0
                  • N Nibu babu thomas

                    kapardhi wrote:

                    what is happening is each time the data is entered into the multiline edit box the scroll bar goes to initial position and then comes down, it appears like blinking,

                    Can you try EM_REPLACESEL. Something like...

                    pEdit->SendMessage( EM_REPLACESEL,
                    TRUE,
                    (LPARAM)static_cast<LPCTSTR>( csTextToBeInserted ));

                    Tell us if the blinking problem does get solved.

                    Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

                    modified on Wednesday, November 26, 2008 7:55 AM

                    K Offline
                    K Offline
                    kapardhi
                    wrote on last edited by
                    #9

                    thanks ! it still blinking but very less no. of times as compared to previous ones !!

                    N 1 Reply Last reply
                    0
                    • K kapardhi

                      thanks ! it still blinking but very less no. of times as compared to previous ones !!

                      N Offline
                      N Offline
                      Nibu babu thomas
                      wrote on last edited by
                      #10

                      Also make sure that no text is selected, else the selection will get replaced which is what this function is meant to do. So you can remove selection (use SetSel) first before calling ReplaceSel. Also note that there is an equivalent MFC function called ReplaceSel.

                      Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

                      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