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. Count of CR in an dit control

Count of CR in an dit control

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

    I am asking again, maybe nobody noticed the question. Or maybe the problem is really 'real' :sigh: An Edit control of Microsoft ( both normal or RichEdit ) is not able to count right the CRLF characters ! Yes, just the ones that Microsoft itself keeps alive ! What it does is just to ignore the '\r' characters in the count, both when using EM_GETSEL and EM_SETSEL Does anyone knows how to do it right ? Thank you very much for any answer Marcello

    A 1 Reply Last reply
    0
    • M Marcello

      I am asking again, maybe nobody noticed the question. Or maybe the problem is really 'real' :sigh: An Edit control of Microsoft ( both normal or RichEdit ) is not able to count right the CRLF characters ! Yes, just the ones that Microsoft itself keeps alive ! What it does is just to ignore the '\r' characters in the count, both when using EM_GETSEL and EM_SETSEL Does anyone knows how to do it right ? Thank you very much for any answer Marcello

      A Offline
      A Offline
      alex barylski
      wrote on last edited by
      #2

      Marcello wrote: Does anyone knows how to do it right ? What do you mean do it right? You want to use both \r\n inside your CEdit control? Why? Are you saving content to a file and need the CRLF? If so, why not just (before saving) search and replace all \n with \r\n and then save to file? Cheers : ) The word of the day is legs, let's go back to my house and spread the word ;P

      M 1 Reply Last reply
      0
      • A alex barylski

        Marcello wrote: Does anyone knows how to do it right ? What do you mean do it right? You want to use both \r\n inside your CEdit control? Why? Are you saving content to a file and need the CRLF? If so, why not just (before saving) search and replace all \n with \r\n and then save to file? Cheers : ) The word of the day is legs, let's go back to my house and spread the word ;P

        M Offline
        M Offline
        Marcello
        wrote on last edited by
        #3

        Thank you for the answer. I use the multiplatform VCF library and helping on it. The fact is the in the library we need to introduce a Control that has the data model separated from the view ( which is the Microsoft's Edit control ). In this way this bug becomes really evident. For multipurpose need we cannot put the text in a canonized form ( like replacing all the \r\n with \n and similar things. I made a workaround, which is to count all the CR characters both before the beginning of a selection and inside the selection itself, and then make some adjust to the counts. But this code is CPU consuming and more orrible than it seems. Because I it is the third time I am posting this problem and you are the only (nice) person who answered, I guess this is just another of Microsoft's bugs. Cheers, Marcello

        A 1 Reply Last reply
        0
        • M Marcello

          Thank you for the answer. I use the multiplatform VCF library and helping on it. The fact is the in the library we need to introduce a Control that has the data model separated from the view ( which is the Microsoft's Edit control ). In this way this bug becomes really evident. For multipurpose need we cannot put the text in a canonized form ( like replacing all the \r\n with \n and similar things. I made a workaround, which is to count all the CR characters both before the beginning of a selection and inside the selection itself, and then make some adjust to the counts. But this code is CPU consuming and more orrible than it seems. Because I it is the third time I am posting this problem and you are the only (nice) person who answered, I guess this is just another of Microsoft's bugs. Cheers, Marcello

          A Offline
          A Offline
          alex barylski
          wrote on last edited by
          #4

          Perhaps you could look at some of the edit controls here on CP and modify them enough to suit your needs? Cheers :) The word of the day is legs, let's go back to my house and spread the word ;P

          M 1 Reply Last reply
          0
          • A alex barylski

            Perhaps you could look at some of the edit controls here on CP and modify them enough to suit your needs? Cheers :) The word of the day is legs, let's go back to my house and spread the word ;P

            M Offline
            M Offline
            Marcello
            wrote on last edited by
            #5

            Yes. It is a good idea. Maybe I will find something. Thank you ! Marcello

            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