Scrollbar thumb behavior

Duane Clark dclark at akamail.com
Fri Aug 2 15:34:01 CDT 2002


This is a repost.

One of my apps (Xilinx fpga_editor yet again) has a "world view" that
was not being activated and deactivated correctly. When the mouse is
pressed in a scrollbar thumb, it should have been immediately activated,
but activation did not occur until the thumb was moved. And upon
releasing the mouse button, the world view was not being deactivated. A
similar behavior occurs with MS Word, where a tooltip style window
should pop up immediately when the mouse is pressed in the thumb.
Instead, it did not get activated until the thumb was moved.

Testing with control spy, the correct behavior is that on mouse down, a
SB_THUMBTRACK message with the current position should be sent, and on
mouse up, a SB_THUMBPOSITION immediately followed by SB_ENDSCROLL. This
patch adds that behavior, fixes both of the applications, and generates 
the correct messages in control spy.

Log message:
	On mouse down in thumb, issue SB_THUMBTRACK with current
	position.
	On mouse up in thumb, issue SB_THUMBPOSITION followed
	by SB_ENDSCROLL




-------------- next part --------------
Index: controls/scroll.c
===================================================================
RCS file: /home/wine/wine/controls/scroll.c,v
retrieving revision 1.54
diff -u -r1.54 scroll.c
--- controls/scroll.c	31 May 2002 23:06:46 -0000	1.54
+++ controls/scroll.c	2 Aug 2002 20:29:22 -0000
@@ -1102,6 +1102,18 @@
         break;
     }
 
+    if (msg == WM_LBUTTONDOWN)
+    {
+
+        if (hittest == SCROLL_THUMB)
+        {
+            UINT val = SCROLL_GetThumbVal( infoPtr, &rect, vertical,
+                                 trackThumbPos + lastMousePos - lastClickPos );
+            SendMessageA( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
+                            MAKEWPARAM( SB_THUMBTRACK, val ), (LPARAM)hwndCtl );
+        }
+    }
+
     if (msg == WM_LBUTTONUP)
     {
 	hittest = SCROLL_trackHitTest;
@@ -1114,8 +1126,7 @@
             SendMessageA( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
                             MAKEWPARAM( SB_THUMBPOSITION, val ), (LPARAM)hwndCtl );
         }
-        else
-            SendMessageA( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
+        SendMessageA( hwndOwner, vertical ? WM_VSCROLL : WM_HSCROLL,
                           SB_ENDSCROLL, (LPARAM)hwndCtl );
     }
 


More information about the wine-patches mailing list