Re: edit - fix WantReturns (Win BUG)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 11 May 2003 20:20:55 -0600, you wrote:

> It looks like Windows has an old BUG in Edit control when handling WM_GetDlgCode message.
> It always returns 0x8D no mater what the style and and properties of a window is.
> Interesting enough, Delphi relays on this behavior.
> 
> Vitaliy Margolen
> 
> changelog:
>   - controls/edit.c
>     fix problem with capturing [return] keys in multi-line edits
> 

Vitaliy, 

This is not right. A edit-listboxcombo, used in Newsbin to enter filter
expressions, gives this result in spy++:

| <00706> 0002022C P WM_KEYDOWN nVirtKey:VK_RETURN cRepeat:1 ScanCode:1C fExtended:0 fAltDown:0 fRepeat:0 fUp:0 [wParam:0000000D lParam:001C0001 time:14:25:17.823]
| <00707> 0002022C S WM_GETDLGCODE wParam:0000000D lParam:0012FD88
| <00708> 00020230 S .CB_GETDROPPEDSTATE wParam:00000000 lParam:00000000
| <00709> 00020230 R .CB_GETDROPPEDSTATE fDropped:False [lResult:00000000]
| <00710> 0002022C R WM_GETDLGCODE fuDlgCode:DLGC_WANTARROWS | DLGC_HASSETSEL | DLGC_WANTCHARS [lResult:00000089]
| <00711> 0002022C S WM_GETDLGCODE wParam:00000000 lParam:00000000
| <00712> 0002022C R WM_GETDLGCODE fuDlgCode:DLGC_WANTARROWS | DLGC_HASSETSEL | DLGC_WANTCHARS [lResult:00000089]

Needless to say this stopped working properly when updating with CVS:((

It is not the CB_GETDROPPEDMESSAGE but the return value that matters
here.

Attached I revert your patch for this special case. I  hope that it
still solves your problem and that you got the other cases right.

Changelog:
	controls/	: edit.c
	Revert the previous patch for capturing keys in an
	edit-listbox combo. 

Rein.
-- 
Rein Klazes
rklazes@xs4all.nl
--- wine/controls/edit.c	2003-05-13 08:03:58.000000000 +0200
+++ mywine/controls/edit.c	2003-05-14 19:39:50.000000000 +0200
@@ -744,10 +744,20 @@
          */
 
 	case WM_GETDLGCODE:
-               result = DLGC_HASSETSEL | DLGC_WANTCHARS | DLGC_WANTARROWS
-                         | DLGC_WANTMESSAGE;
-                /* Windows BUG! Windows always returns DLGC_WANTMESSAGE flag without additional checks. */
-                break;
+		result = DLGC_HASSETSEL | DLGC_WANTCHARS | DLGC_WANTARROWS;
+                if( es->hwndListBox )
+                {
+                    if (lParam && (((LPMSG)lParam)->message == WM_KEYDOWN))
+                    {
+                       int vk = (int)((LPMSG)lParam)->wParam;
+                       if( vk == VK_RETURN || vk == VK_ESCAPE)
+                           if( SendMessageW(GetParent(hwnd), CB_GETDROPPEDSTATE, 0, 0))
+                                result |= DLGC_WANTMESSAGE;
+                    }
+		} else
+                    /* It seems in all other cases Windows has this set: */
+                    result |= DLGC_WANTMESSAGE;
+		break;
 
         case WM_IME_CHAR:
             if (!unicode)

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux