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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Adding text to CRicheditctrl?

Adding text to CRicheditctrl?

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

    I have a dialog based application and I have added a CRichEditCtrl to the dialog using the resource editor (incl. a CRichEditCtrl member variable). Now I am trying to add text to this control if the user clicks on a button. I have the following code in the message handler of the button: m_RTFEdit.SetSel(-1,-1); m_RTFEdit.ReplaceSel(pszData); But this seems not to work. In the past I used StreamIn to copy text to a rich edit ctrl but now I want to use ReplaceSel. Is it possible that the CRichEditCtrl loses the focus and so ReplaceSel can not work? Thanks in advance for your help.

    D 1 Reply Last reply
    0
    • C CodeBrain

      I have a dialog based application and I have added a CRichEditCtrl to the dialog using the resource editor (incl. a CRichEditCtrl member variable). Now I am trying to add text to this control if the user clicks on a button. I have the following code in the message handler of the button: m_RTFEdit.SetSel(-1,-1); m_RTFEdit.ReplaceSel(pszData); But this seems not to work. In the past I used StreamIn to copy text to a rich edit ctrl but now I want to use ReplaceSel. Is it possible that the CRichEditCtrl loses the focus and so ReplaceSel can not work? Thanks in advance for your help.

      D Offline
      D Offline
      Dominik Reichl
      wrote on last edited by
      #2

      Have you tried m_RTFEdit.SetSel(**0**,-1); m_RTFEdit.ReplaceSel(pszData); Best regards, Dominik


      _outp(0x64, 0xAD); and __asm mov al, 0xAD __asm out 0x64, al do the same... but what do they do?? ;) (doesn't work on NT)

      C 1 Reply Last reply
      0
      • D Dominik Reichl

        Have you tried m_RTFEdit.SetSel(**0**,-1); m_RTFEdit.ReplaceSel(pszData); Best regards, Dominik


        _outp(0x64, 0xAD); and __asm mov al, 0xAD __asm out 0x64, al do the same... but what do they do?? ;) (doesn't work on NT)

        C Offline
        C Offline
        CodeBrain
        wrote on last edited by
        #3

        Yes and I have also tried GetSel(start, end); SetSel(end, -1); But GetSel returns 0,0 so I think the problem is that the RTF ctrl loses the focus(?)

        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