On Wed, 25 Oct 2000, Francois Gouget wrote:

> On 25 Oct 2000, Alexandre Julliard wrote:
[...]
>    But something else has changed which is causing some annoying breakage in
> notepad (at least on my machine). I'm sure it's not Dmitry's patch
> because I have the same problem even without it.
>    The symptoms:
>  * Ctrl-X, does not work any more

   I'm still not sure about this one.


>  * Each time I type 'enter' the caret appears in the wrong place.  Still
> the next letter I type appears at the right place and the caret appears
> again where it's supposed to be. 

   I found the patch that causes the bug for this one. It's the 'scroll'
patch that I resubmited twice. And of course, it's only now that it has
been commited in CVS that I find the problem :-((((

   Basically, when we type Enter in notepad, the position of the
vertical scrollbar is adjusted and the following code is executed (from 
SCROLL_DrawScrollBar):

--- controls/scroll.c   2000/09/26 22:20:14     1.26
+++ controls/scroll.c   2000/10/25 21:26:27     1.27
@@ -816,6 +816,18 @@
         (SCROLL_TrackingBar == nBar))
         SCROLL_DrawMovingThumb( hdc, &rect, vertical, arrowSize,
thumbSize );
 
+    if(hwnd==GetFocus())  /* if scroll bar has focus, reposition the
caret*/
+    {
+        if (!vertical)
+        {
+            SetCaretPos(thumbPos+1, rect.top+1);
+        }
+        else
+        {
+            SetCaretPos(rect.top+1, thumbPos+1);
+        }
+    }
+
 END:
     WIN_ReleaseWndPtr(wndPtr);
 }


   The test 'hwnd==GetFocus()' returns true because a scrollbar does not
have an hwnd of its own and thus the scrollbar believes it has the focus
and repositions the caret.

   So the test to know if the scrollbar has the focus is wrong. I tried
fixing the problem by removing this code and doing the caret
repositioning in the handling of WM_KEYUP (so I don't have to remember
if the scrollbar has the focus) but this does not work when one moves
the scrollbar with the mouse (the caret is left behind). 

   So the question is: how do we know if the scrollbar has the focus? 


--
Francois Gouget         [EMAIL PROTECTED]        http://fgouget.free.fr/
                     f u kn rd ts, ur wy 2 gky 4 ur wn gd.




Reply via email to