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. Edit Box

Edit Box

Scheduled Pinned Locked Moved C / C++ / MFC
delphi
7 Posts 4 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.
  • C Offline
    C Offline
    chethu665
    wrote on last edited by
    #1

    hi all, is it possible to get the cursor position in the edit box like the cursor is after 3 chars from the start or 5 chars from the start like that . "Men never do evil so completely and cheerfully as when they do it from religious conviction" -Pascal

    T N _ 4 Replies Last reply
    0
    • C chethu665

      hi all, is it possible to get the cursor position in the edit box like the cursor is after 3 chars from the start or 5 chars from the start like that . "Men never do evil so completely and cheerfully as when they do it from religious conviction" -Pascal

      T Offline
      T Offline
      ThatsAlok
      wrote on last edited by
      #2

      chethu665 wrote:

      s it possible to get the cursor position in the edit box like the cursor is after 3 chars from the start or 5 chars from the start like that .

      Use GetCurPos and CEdit::CharFromPos at tandum!

      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

      cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

      1 Reply Last reply
      0
      • C chethu665

        hi all, is it possible to get the cursor position in the edit box like the cursor is after 3 chars from the start or 5 chars from the start like that . "Men never do evil so completely and cheerfully as when they do it from religious conviction" -Pascal

        N Offline
        N Offline
        NiceNaidu fo
        wrote on last edited by
        #3

        Check this article.It has some info related to getting cursor position. http://www.codeproject.com/editctrl/editctrltutorial.asp[^] Appu.. "If you judge people, you have no time to love them."

        1 Reply Last reply
        0
        • C chethu665

          hi all, is it possible to get the cursor position in the edit box like the cursor is after 3 chars from the start or 5 chars from the start like that . "Men never do evil so completely and cheerfully as when they do it from religious conviction" -Pascal

          _ Offline
          _ Offline
          _AnsHUMAN_
          wrote on last edited by
          #4

          p=m_edit.GetCaretPos ();
          int t=m_edit.CharFromPos (p);
          //t has the value that you need
          /*CString s;
          s.Format("%d",t);
          AfxMessageBox(s);*/

          ******m_edit is the edit box control and p is a POINT type variable Uncomment the above 3 lines that are commented to print the value in the message box. Does this help you? Somethings seem HARD to do, until we know how to do them. ;-) _AnShUmAn_ -- modified at 8:31 Monday 5th June, 2006

          C 1 Reply Last reply
          0
          • C chethu665

            hi all, is it possible to get the cursor position in the edit box like the cursor is after 3 chars from the start or 5 chars from the start like that . "Men never do evil so completely and cheerfully as when they do it from religious conviction" -Pascal

            N Offline
            N Offline
            NiceNaidu fo
            wrote on last edited by
            #5

            Hey, Check the MSDN Documentation related to GetSel and EM_GETSEL http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/editcontrols/editcontrolreference/editcontrolmessages/em_getsel.asp[^] Appu.. "If you judge people, you have no time to love them."

            T 1 Reply Last reply
            0
            • _ _AnsHUMAN_

              p=m_edit.GetCaretPos ();
              int t=m_edit.CharFromPos (p);
              //t has the value that you need
              /*CString s;
              s.Format("%d",t);
              AfxMessageBox(s);*/

              ******m_edit is the edit box control and p is a POINT type variable Uncomment the above 3 lines that are commented to print the value in the message box. Does this help you? Somethings seem HARD to do, until we know how to do them. ;-) _AnShUmAn_ -- modified at 8:31 Monday 5th June, 2006

              C Offline
              C Offline
              chethu665
              wrote on last edited by
              #6

              thanks a lot man ! i worked .:) "Men never do evil so completely and cheerfully as when they do it from religious conviction" -Pascal

              1 Reply Last reply
              0
              • N NiceNaidu fo

                Hey, Check the MSDN Documentation related to GetSel and EM_GETSEL http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/editcontrols/editcontrolreference/editcontrolmessages/em_getsel.asp[^] Appu.. "If you judge people, you have no time to love them."

                T Offline
                T Offline
                ThatsAlok
                wrote on last edited by
                #7

                NiceNaidu wrote:

                GetSel and EM_GETSEL

                Sorry to trouble you,This Will Retrive the Selected Text not actual Caret Position

                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

                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