# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1036777139 0 # Node ID 63258b34e70dec6b581ce14c77ea10a528da36a5 # Parent 840c5476630641b67a4ad7f027de67430f7de81f Minor changes. diff -r 840c54766306 -r 63258b34e70d os2/dw.c --- a/os2/dw.c Thu Nov 07 22:31:02 2002 +0000 +++ b/os2/dw.c Fri Nov 08 17:38:59 2002 +0000 @@ -166,6 +166,29 @@ return handle; } +/* Return the entryfield child of a window */ +HWND _find_entryfield(HWND handle) +{ + HENUM henum; + HWND child, entry = 0; + + henum = WinBeginEnumWindows(handle); + while((child = WinGetNextWindow(henum)) != NULLHANDLE) + { + char tmpbuf[100]; + + WinQueryClassName(child, 99, tmpbuf); + + if(strncmp(tmpbuf, "#6", 3)==0) /* Entryfield */ + { + entry = child; + break; + } + } + WinEndEnumWindows(henum); + return entry; +} + /* This function changes the owner of buttons in to the * dynamicwindows handle to fix a problem in notebooks. */ @@ -1465,8 +1488,6 @@ /* Get the entryfield handle from multi window controls */ if(strncmp(tmpbuf, "#2", 3)==0) handle = WinWindowFromID(hWnd, 667); - if(strncmp(tmpbuf, "#32", 4)==0) - handle = WinWindowFromID(hWnd, 1703); if(handle) { @@ -1592,6 +1613,28 @@ return _entryproc(hWnd, msg, mp1, mp2); } +/* Handle special messages for the spinbutton's entryfield */ +MRESULT EXPENTRY _spinentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) +{ + WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); + PFNWP oldproc = 0; + + if(blah) + oldproc = blah->oldproc; + + switch(msg) + { + case WM_CONTEXTMENU: + case WM_COMMAND: + return _entryproc(hWnd, msg, mp1, mp2); + } + + if(oldproc) + return oldproc(hWnd, msg, mp1, mp2); + + return WinDefWindowProc(hWnd, msg, mp1, mp2); +} + int _dw_int_pos(HWND hwnd) { int pos = (int)dw_window_get_data(hwnd, "_dw_percent_value"); @@ -4045,9 +4088,13 @@ id, NULL, NULL); + HWND entry = _find_entryfield(tmp); dw_window_set_font(tmp, DefaultFont); blah->oldproc = WinSubclassWindow(tmp, _entryproc); WinSetWindowPtr(tmp, QWP_USER, blah); + blah = calloc(sizeof(WindowData), 1); + blah->oldproc = WinSubclassWindow(entry, _spinentryproc); + WinSetWindowPtr(entry, QWP_USER, blah); return tmp; }