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 Control

Edit Control

Scheduled Pinned Locked Moved C / C++ / MFC
help
5 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.
  • S Offline
    S Offline
    si_69
    wrote on last edited by
    #1

    Hi I have an edit control which i have a character counter on this works fine, but when i exceed 256 chars the cursor jumps to the start of the edit control For my counter i am using void CMyMessagePage::OnEnChangeEMsg() { UpdateData(TRUE); int nBytes = lstrlen(m_message); CString len; len.Format("%d",nBytes); m_sms_written = len; UpdateData(FALSE); } Can anyone help thanks Simon

    _ B 2 Replies Last reply
    0
    • S si_69

      Hi I have an edit control which i have a character counter on this works fine, but when i exceed 256 chars the cursor jumps to the start of the edit control For my counter i am using void CMyMessagePage::OnEnChangeEMsg() { UpdateData(TRUE); int nBytes = lstrlen(m_message); CString len; len.Format("%d",nBytes); m_sms_written = len; UpdateData(FALSE); } Can anyone help thanks Simon

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

      Check out SetLimitText(UINT /*param*/) API

      You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_

      S 1 Reply Last reply
      0
      • _ _AnsHUMAN_

        Check out SetLimitText(UINT /*param*/) API

        You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_

        S Offline
        S Offline
        si_69
        wrote on last edited by
        #3

        _AnShUmAn_ wrote:

        Check out SetLimitText(UINT /*param*/) API

        thanks, i am already using SetLimitText my problem is not the size of text allowed as i can exceed 256, it is when i reach 256 characters the cursor jumps to the start

        1 Reply Last reply
        0
        • S si_69

          Hi I have an edit control which i have a character counter on this works fine, but when i exceed 256 chars the cursor jumps to the start of the edit control For my counter i am using void CMyMessagePage::OnEnChangeEMsg() { UpdateData(TRUE); int nBytes = lstrlen(m_message); CString len; len.Format("%d",nBytes); m_sms_written = len; UpdateData(FALSE); } Can anyone help thanks Simon

          B Offline
          B Offline
          BadJerry
          wrote on last edited by
          #4

          Hi There are some problems with UpdateData(true) / UpdateData(false) and you may lose your position if the system thinks the string has changed in the process (it happens also with numbers and decimal points etc) ... you can use CEdit::GetSel and CEdit::SetSel to save and reset your cursor position... hope this helps!

          S 1 Reply Last reply
          0
          • B BadJerry

            Hi There are some problems with UpdateData(true) / UpdateData(false) and you may lose your position if the system thinks the string has changed in the process (it happens also with numbers and decimal points etc) ... you can use CEdit::GetSel and CEdit::SetSel to save and reset your cursor position... hope this helps!

            S Offline
            S Offline
            si_69
            wrote on last edited by
            #5

            thx

            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