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 select text in CEdit Control

How to select text in CEdit Control

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
5 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.
  • O Offline
    O Offline
    Ola Carlsson
    wrote on last edited by
    #1

    How can I select the text in a CEdit control. I have tried the SetSel(first_pos, last_pos) but the text don't be "blue". SetSel() works fine to cut or paste... but i want the text to be marked whit the blue line, as when using mouse. regards, Ola

    N 1 Reply Last reply
    0
    • O Ola Carlsson

      How can I select the text in a CEdit control. I have tried the SetSel(first_pos, last_pos) but the text don't be "blue". SetSel() works fine to cut or paste... but i want the text to be marked whit the blue line, as when using mouse. regards, Ola

      N Offline
      N Offline
      Nish Nishant
      wrote on last edited by
      #2

      After the SetSel you need to do a SetFocus :-)

      m_pedit.SetSel(1,10);
      m_pedit.SetFocus();

      Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

      O 1 Reply Last reply
      0
      • N Nish Nishant

        After the SetSel you need to do a SetFocus :-)

        m_pedit.SetSel(1,10);
        m_pedit.SetFocus();

        Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

        O Offline
        O Offline
        Ola Carlsson
        wrote on last edited by
        #3

        hmm... I still can't get the text marked blue. /Ola

        N 1 Reply Last reply
        0
        • O Ola Carlsson

          hmm... I still can't get the text marked blue. /Ola

          N Offline
          N Offline
          Nish Nishant
          wrote on last edited by
          #4

          Then what color are they coming in? Or are you saying text is not even selected? And does the cursor start blinking in the edit box? Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

          O 1 Reply Last reply
          0
          • N Nish Nishant

            Then what color are they coming in? Or are you saying text is not even selected? And does the cursor start blinking in the edit box? Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

            O Offline
            O Offline
            Ola Carlsson
            wrote on last edited by
            #5

            Text in edit box is not visible selected. Cursor starts blinking, and if I use m_editbox1.Cut(); text disappear. If I write some, text in edit box are not replaced. Code example: void CMyClass::OnSetfocusBox1() { m_box1.SetSel(1,10); m_box1.SetFocus(); // m_box1.Cut(); works, but text in box are never visable selected. } Ola

            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