Hello again,

I was worrying myself over the following problem:

Consider a CEdit control in a scrollable window. When the window is scrolled and consequently the CEdit control is scrolled out of view, the blinking cursor still follows to the next scrolled region. I assumed this was because the CEdit still retained focus and demanded to be present in the scrolled area. This is of course highly undesirable and what I wish is for the CEdit to retain focus only when it is scrolled back into view.

So I recorded the values of m_nHScrollPos and m_nVScrollPos in separate variables, nHScreenView and nVScreenView respectively upon creation of the CEdit control. I then ordered the CEdit control to be destroyed as soon as the window was scrolled (at the very end of the OnVScroll, OnHScroll functions). Finally I use this code to recreate the CEdit control when the area containing the CEdit control is scrolled into view. Again this code is present at the end of the WM_*SCROLL message functions.

Code:
if(m_nHScrollPos == nHScreenView && m_nVScrollPos == nVScreenView)
{
    ceTextIn.Create(/*parameters*/);
    ceTextIn.SetFocus();
}
It doesn't seem to be working. Debugging reveals that the above pocket of code is never reached.

Could you shed light on what I'm doing wrong? In essence, I just want a CEdit control to behave itself (like a good CEdit control should) and only be editable when it is present in the scrolled area.

Thanks a lot in advance,
Cheers!