Rich edit control problem: sometimes users have to click twice to position cursor

  • Thread starter Thread starter simon22
  • Start date Start date
S

simon22

Guest
Hi - my Visual C++ (VS 2017) MFC application uses a rich edit control and I have found a strange problem. Suppose my application is displaying a floating modeless dialog containing a rich edit control with some text in it - say, "Hello World!". Suppose the user wants to position the cursor before the 'W' in world. If they move the mouse to that position and click the mouse button, the I-bar should move before the 'W'. That works fine if the dialog is active before the user clicks. But if it is inactive, if another window has the focus, what happens is that the rich edit contol acquires the focus (and the dialog it is on, is activated), and the I-bar becomes visible - but the I-bar is not moved to the position that the user clicked on. If the user then clicks again, this time it will work. So the user often has to click twice to achieve what should be achievable in one click.

This problem only affects rich edit controls. Ordinary edit controls never require 2 clicks.

Oddly the problem does not occur if the modeless dialog is active, but another control has the focus. In that a case, a single click is all you need to position the I-bar where you want it. So it isn't just a focus-passing issue. The problem only happens if the actual window (or dialog) in which the rich edit control is embedded, is not the active window.

I thought at first it must be something I had done in my code, but I built a small do-nothing test sample (MFC dialog) application and it exhibits exactly the same thing. I can upload it somewhere if that helps.

Can anyone suggest anything I can do to fix this?


Simon

Continue reading...
 
Back
Top