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