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. Clearing a CRichTextCtrl? Not in XP...

Clearing a CRichTextCtrl? Not in XP...

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

    In this piece of code I expect a CRichEditCtrl to clear itself. It works fine in Win98, in XP nothing happens.

    UpdateData(TRUE);
    m_profileCtrl.UpdateData(TRUE);
    m_profile.Empty();
    m_profile.Delete(0,m_profile.GetLength());
    m_profile = _T("");
    m_profileCtrl.UpdateData(FALSE);
    UpdateData(FALSE);

    Of course this piece of code is a bit overkill, yet it should work. :) Am I making some sort of stupid mistake, or can I safely blame XP? Also, is there another way to clear a text box properly? Cheers!

    J J 2 Replies Last reply
    0
    • J Joaquin M Lopez Munoz

      Try adding an UpdateWindow call at the end (though I thought it should work without it.) Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

      G Offline
      G Offline
      generic_user_id
      wrote on last edited by
      #2

      I found it! You'll NEVER believe it, but the ONLY way to make it work was by setting the text to a space _T(" "); Unbelievable! Thanks for your quick answer though!

      J 1 Reply Last reply
      0
      • G generic_user_id

        In this piece of code I expect a CRichEditCtrl to clear itself. It works fine in Win98, in XP nothing happens.

        UpdateData(TRUE);
        m_profileCtrl.UpdateData(TRUE);
        m_profile.Empty();
        m_profile.Delete(0,m_profile.GetLength());
        m_profile = _T("");
        m_profileCtrl.UpdateData(FALSE);
        UpdateData(FALSE);

        Of course this piece of code is a bit overkill, yet it should work. :) Am I making some sort of stupid mistake, or can I safely blame XP? Also, is there another way to clear a text box properly? Cheers!

        J Offline
        J Offline
        Joaquin M Lopez Munoz
        wrote on last edited by
        #3

        Try adding an UpdateWindow call at the end (though I thought it should work without it.) Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

        G 1 Reply Last reply
        0
        • G generic_user_id

          I found it! You'll NEVER believe it, but the ONLY way to make it work was by setting the text to a space _T(" "); Unbelievable! Thanks for your quick answer though!

          J Offline
          J Offline
          Joaquin M Lopez Munoz
          wrote on last edited by
          #4

          Hmmm... this does seem like a bug to me. Maybe someone else here can enlighten us. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

          G 1 Reply Last reply
          0
          • J Joaquin M Lopez Munoz

            Hmmm... this does seem like a bug to me. Maybe someone else here can enlighten us. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

            G Offline
            G Offline
            generic_user_id
            wrote on last edited by
            #5

            It was very odd, and frustrating, as I don't have XP myself. So I kept sending patches, but they didn't work :) - Griffith

            1 Reply Last reply
            0
            • G generic_user_id

              In this piece of code I expect a CRichEditCtrl to clear itself. It works fine in Win98, in XP nothing happens.

              UpdateData(TRUE);
              m_profileCtrl.UpdateData(TRUE);
              m_profile.Empty();
              m_profile.Delete(0,m_profile.GetLength());
              m_profile = _T("");
              m_profileCtrl.UpdateData(FALSE);
              UpdateData(FALSE);

              Of course this piece of code is a bit overkill, yet it should work. :) Am I making some sort of stupid mistake, or can I safely blame XP? Also, is there another way to clear a text box properly? Cheers!

              J Offline
              J Offline
              James R Twine
              wrote on last edited by
              #6

              Just a hunch; try it without misusing the CString object:     CRichEditCtrl::SetWindowText( _T( "" ) );    Peace! -=- James. "Fat people are hard to kidnap." (Try Check Favorites Sometime!)

              G 1 Reply Last reply
              0
              • J James R Twine

                Just a hunch; try it without misusing the CString object:     CRichEditCtrl::SetWindowText( _T( "" ) );    Peace! -=- James. "Fat people are hard to kidnap." (Try Check Favorites Sometime!)

                G Offline
                G Offline
                generic_user_id
                wrote on last edited by
                #7

                That was about the first thing that came to mind with me, and much to my surprise that didn't work. Especially because the CRichEditCtrl::Clear(); fuction refused to work too.

                J 1 Reply Last reply
                0
                • G generic_user_id

                  That was about the first thing that came to mind with me, and much to my surprise that didn't work. Especially because the CRichEditCtrl::Clear(); fuction refused to work too.

                  J Offline
                  J Offline
                  James R Twine
                  wrote on last edited by
                  #8

                  Then that sounds like either (1) a serious bug in the RE Control, or (2) a redraw problem.    Peace! -=- James. "Fat people are hard to kidnap." (Try Check Favorites Sometime!)

                  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