Click here to Skip to main content
15,905,679 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Link error 2019 Pin
arun_pk11-Jun-10 3:10
arun_pk11-Jun-10 3:10 
GeneralRe: Link error 2019 Pin
arun_pk11-Jun-10 3:09
arun_pk11-Jun-10 3:09 
GeneralRe: Link error 2019 Pin
Cool_Dev11-Jun-10 3:15
Cool_Dev11-Jun-10 3:15 
GeneralRe: Link error 2019 Pin
arun_pk11-Jun-10 3:18
arun_pk11-Jun-10 3:18 
GeneralRe: Link error 2019 Pin
arun_pk11-Jun-10 3:20
arun_pk11-Jun-10 3:20 
AnswerRe: Link error 2019 Pin
Cedric Moonen11-Jun-10 2:44
Cedric Moonen11-Jun-10 2:44 
GeneralRe: Link error 2019 Pin
arun_pk11-Jun-10 2:46
arun_pk11-Jun-10 2:46 
QuestionGlitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Robert Inventor10-Jun-10 23:36
Robert Inventor10-Jun-10 23:36 
Hi there,

I have a mysterious bug in a rich edit control one of my programs. It is sporadic and I haven't been able to find any way to duplicate it. It just suddenly happens when mid-edit of the text. You go for days sometimes with no occurrence of the bug, then suddenly without warning it will happen.

The richedit class is
RICHEDIT20A

What happens


Part of the text gets displayed incorrectly formatted. If you click on it to set the caret, then some parts are inaccessible. The caret also sometimes isn't synchronised with the click point so you click in one place in the window and the caret gets set somewhere else, usually at the same y coord, and to the left or the right of the click point.

Manifests in many ways but most often, the visual display of the text changes to show the first character of each line on a separate line of the window. Like this:

This is actual text copied from most recent time it happened:
do a search for ,,

Volume envelope for editable waveform instrument (Ctrl + ) - makes a difference for instruments selected not the editable instrument


Mid edit, this suddenly changed so it was displayed as
|d
o a search for |,,
|V
olume envelope for editable waveform instrument (Ctrl + ) - makes a difference for instruments| selected not the editable instrument


There the | shows the furthest right you can set the caret in each line. So e.g. if you click to the right of the first d, then the caret gets set at the start of the line, not after the 'd' as you would expect.

If you click to the right of instruments in the second line the caret gets set immediately after the s and you can't set it any further to the right than that.

You can highlight text in that "inaccessible" area of the text with click and drag, but the caret doesn't change position when you do that.

The same text displays fine in other rich edit controls


If you copy / paste the text to another rich edit, then it displays fine. If you look at the rich edit source, everything looks fine too. No unusual fonts used, it is usually all one font when it happens.

Clears up if you stream the rich edit source code out and back in again


Display issues clear up on resize, and on switch word wrap on / off. But some of the text may still be inaccessible and the caret positioned incorrectly when you click on the text.

Clears up completely if you edit the rich edit source. In the program then what happens when the user does that is that it uses EM_STREAMOUT and EM_STREAMIN to stream the rich edit contents out to a string, display that string in a plain text edit control, then stream back into the rich edit. So, you do that the issue is fixed until next time it happens.

So seems pretty clear that there is nothing wrong with the actual rich edit source for the control.

Example source code


What the richedit source looks like is like this:
{\rtf1\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{\f0\fnil\fcharset0 Arial;}}
\viewkind4\uc1\pard\fs20
do a search of source code for ,,\par
\par
...
}


- that's after an EM_STREAMOUT from the problematical richedit control.

I subclass the richedit, but do nothing unusual in the subclassing (just do a bit of extra processing for WM_KEYDOWN etc), and I also added an option to switch off the subclassing - and it still happened with it disabled.

Can't think of anything else unusual I do apart from the EM_STREAMOUT and EM_STREAMIN.

I have been able to duplicate a few times while running the program in the debugger, and was able to break after the bug happened but again everything seemed fine in the code.

Have any of you got any ideas at all about what this might be? Or any lines of investigation that I could follow up.
AnswerRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Code-o-mat12-Jun-10 5:16
Code-o-mat12-Jun-10 5:16 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Robert Inventor12-Jun-10 6:25
Robert Inventor12-Jun-10 6:25 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Code-o-mat12-Jun-10 7:00
Code-o-mat12-Jun-10 7:00 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Robert Inventor12-Jun-10 15:18
Robert Inventor12-Jun-10 15:18 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Robert Inventor12-Jun-10 15:34
Robert Inventor12-Jun-10 15:34 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly [modified] Pin
Robert Inventor12-Jun-10 15:35
Robert Inventor12-Jun-10 15:35 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Code-o-mat12-Jun-10 23:08
Code-o-mat12-Jun-10 23:08 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Robert Inventor13-Jun-10 5:40
Robert Inventor13-Jun-10 5:40 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Code-o-mat13-Jun-10 5:53
Code-o-mat13-Jun-10 5:53 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Robert Inventor13-Jun-10 10:50
Robert Inventor13-Jun-10 10:50 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Code-o-mat13-Jun-10 11:14
Code-o-mat13-Jun-10 11:14 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Robert Inventor20-Jun-10 6:03
Robert Inventor20-Jun-10 6:03 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Code-o-mat20-Jun-10 7:43
Code-o-mat20-Jun-10 7:43 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Robert Inventor3-Jul-10 6:30
Robert Inventor3-Jul-10 6:30 
GeneralRe: Glitchy mouse clicks out of sync. with position of caret in RichEdit control and text displayed incorrectly Pin
Code-o-mat3-Jul-10 6:43
Code-o-mat3-Jul-10 6:43 
QuestionMs PowerPoint Pin
MsmVc10-Jun-10 23:21
MsmVc10-Jun-10 23:21 
AnswerRe: Ms PowerPoint Pin
Cool_Dev10-Jun-10 23:55
Cool_Dev10-Jun-10 23:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.