Recording a particular "View" or "Area" during scrolling.
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.
Re: Recording a particular "View" or "Area" during scrolling.
Originally Posted by Alex F
The condition is to fix the unknown bug in the code that you didn't post.
Alex, are you saying that the condition is flawless? I'd be extremely relieved if the error lay outside that because I've been raking my brains hard.
I've actually posted all the relevant code there is to this problem. I could further elaborate on the structure of this code.
There is a special function CreateFields(...) in an object of my custom class CEntry which contains the CEdit control. This is called by the child window when it is necessary to create the CEdit control.