Slightly improve keyboard tracking in combobox

Dmitry Timoshkov dmitry at sloboda.ru
Sat Apr 14 12:51:57 CDT 2001


Hello.

Mixed keyboard/mouse tracking in the combo/listbox currently is broken.
This patch at least makes focus to not jump over items.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Slightly improve keyboard tracking in combobox.

--- cvs/hq/wine/controls/listbox.c	Tue Apr 10 08:46:53 2001
+++ wine/controls/listbox.c	Sun Apr 15 01:19:49 2001
@@ -753,6 +753,8 @@
         if (!lParam)
             return strlenW(descr->items[index].str);
 
+	TRACE("index %d (0x%04x) %s\n", index, index, debugstr_w(descr->items[index].str));
+
         if(unicode)
         {
             LPWSTR buffer = (LPWSTR)lParam;
@@ -2046,6 +2048,7 @@
 
         if(!PtInRect(&screenRect, screenMousePos))
         { 
+	    LISTBOX_SetCaretIndex( pWnd, pDescr, pDescr->lphc->droppedIndex, FALSE );
             LISTBOX_SetSelection( pWnd, pDescr, pDescr->lphc->droppedIndex, FALSE, FALSE );
             COMBO_FlipListbox( pDescr->lphc, FALSE, FALSE );
             return 0;
@@ -2745,6 +2748,10 @@
     {
         INT index;
         LPWSTR textW;
+
+	if(HAS_STRINGS(descr))
+	    TRACE("LB_SELECTSTRING: %s\n", unicode ? debugstr_w((LPWSTR)lParam) :
+						     debugstr_a((LPSTR)lParam));
         if(unicode || !HAS_STRINGS(descr))
             textW = (LPWSTR)lParam;
         else
@@ -2758,7 +2765,10 @@
         if(!unicode && HAS_STRINGS(descr))
             HeapFree(GetProcessHeap(), 0, textW);
         if (index != LB_ERR)
+	{
+	    LISTBOX_SetCaretIndex( wnd, descr, index, TRUE );
             LISTBOX_SetSelection( wnd, descr, index, TRUE, FALSE );
+	}
         return index;
     }
 
@@ -3061,7 +3071,7 @@
                                              WPARAM wParam, LPARAM lParam, BOOL unicode )
 {
     LRESULT lRet = 0;
-    HWND hwnd = wnd->hwndSelf;
+    HWND hwnd;
 
     if (wnd)
     {
@@ -3069,6 +3079,8 @@
 
         TRACE_(combo)("[%04x]: msg %s wp %08x lp %08lx\n",
 		     wnd->hwndSelf, SPY_GetMsgName(msg), wParam, lParam );
+
+	hwnd = wnd->hwndSelf;
 
 	if( descr || msg == WM_CREATE )
         {






More information about the wine-patches mailing list