Edit control notification fix
Dmitry Timoshkov
dmitry at sloboda.ru
Fri Mar 9 01:52:56 CST 2001
Hello.
Andreas Mohr privately reported that some old 16-bit installer
started to not update its edit control after my patch entitled
"Do not notify parent of the Edit control on WM_SETTEXT when Edit
is part of the ComboBox." Investigation has shown that installer
has its main dialog window defined in resources, and DIALOG_GetControl16()
gets edit control with style ES_COMBO (0x200) defined there.
My first attempt to fix the trouble was to simply mask out not
allowed styles in the DIALOG_GetControl16(): i.e. for edit control
do style &= ~ES_COMBO. That hack cured the application, but Andreas
didn't like that approach. After some thinking, I added yet another
test into my "Edit Control Test Suit". And here is the result of it.
Changelog:
Dmitry Timoshkov <dmitry at codeweavers.com>
Do not send notification to parent of an edit control,
if parent is a child window. Remove old and not correct patch.
--- cvs/wine/controls/edit.c Tue Mar 6 21:05:24 2001
+++ wine/controls/edit.c Fri Mar 9 15:17:15 2001
@@ -133,10 +133,16 @@
(SendMessageW((wnd)->parent->hwndSelf, WM_CTLCOLOREDIT, \
(WPARAM)(hdc), (LPARAM)(wnd)->hwndSelf))
#define EDIT_NOTIFY_PARENT(wnd, wNotifyCode, str) \
- do {DPRINTF_EDIT_NOTIFY((wnd)->parent->hwndSelf, str); \
- SendMessageW((wnd)->parent->hwndSelf, WM_COMMAND, \
+ do \
+ { \
+ if(!((wnd)->parent->dwStyle & WS_CHILD)) \
+ { \
+ DPRINTF_EDIT_NOTIFY((wnd)->parent->hwndSelf, str); \
+ SendMessageW((wnd)->parent->hwndSelf, WM_COMMAND, \
MAKEWPARAM((wnd)->wIDmenu, wNotifyCode), \
- (LPARAM)(wnd)->hwndSelf);} while(0)
+ (LPARAM)(wnd)->hwndSelf); \
+ } \
+ } while(0)
#define DPRINTF_EDIT_MSG16(str) \
TRACE(\
"16 bit : " str ": hwnd=%08x, wParam=%08x, lParam=%08x\n", \
@@ -4224,7 +4230,8 @@
EDITSTATE *es;
UINT alloc_size;
- TRACE("Creating %s edit control\n", unicode ? "Unicode" : "ANSI");
+ TRACE("Creating %s edit control, style = %08lx\n",
+ unicode ? "Unicode" : "ANSI", style);
if (!(es = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*es))))
return FALSE;
@@ -4512,13 +4519,13 @@
EDIT_EM_SetSel(wnd, es, 0, (UINT)-1, FALSE);
if (text) {
TRACE("%s\n", debugstr_w(text));
- EDIT_EM_ReplaceSel(wnd, es, FALSE, text, !(es->style & (ES_MULTILINE | ES_COMBO)));
+ EDIT_EM_ReplaceSel(wnd, es, FALSE, text, !(es->style & ES_MULTILINE));
if(!unicode)
HeapFree(GetProcessHeap(), 0, text);
} else {
static const WCHAR empty_stringW[] = {0};
TRACE("<NULL>\n");
- EDIT_EM_ReplaceSel(wnd, es, FALSE, empty_stringW, !(es->style & (ES_MULTILINE | ES_COMBO)));
+ EDIT_EM_ReplaceSel(wnd, es, FALSE, empty_stringW, !(es->style & ES_MULTILINE));
}
es->x_offset = 0;
es->flags &= ~EF_MODIFIED;
More information about the wine-patches
mailing list