comparison os2/dw.c @ 156:63258b34e70d

Minor changes.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 08 Nov 2002 17:38:59 +0000
parents 840c54766306
children a07dd2e819f3
comparison
equal deleted inserted replaced
155:840c54766306 156:63258b34e70d
162 lastbox = box; 162 lastbox = box;
163 } 163 }
164 if(box > 0) 164 if(box > 0)
165 return lastbox; 165 return lastbox;
166 return handle; 166 return handle;
167 }
168
169 /* Return the entryfield child of a window */
170 HWND _find_entryfield(HWND handle)
171 {
172 HENUM henum;
173 HWND child, entry = 0;
174
175 henum = WinBeginEnumWindows(handle);
176 while((child = WinGetNextWindow(henum)) != NULLHANDLE)
177 {
178 char tmpbuf[100];
179
180 WinQueryClassName(child, 99, tmpbuf);
181
182 if(strncmp(tmpbuf, "#6", 3)==0) /* Entryfield */
183 {
184 entry = child;
185 break;
186 }
187 }
188 WinEndEnumWindows(henum);
189 return entry;
167 } 190 }
168 191
169 /* This function changes the owner of buttons in to the 192 /* This function changes the owner of buttons in to the
170 * dynamicwindows handle to fix a problem in notebooks. 193 * dynamicwindows handle to fix a problem in notebooks.
171 */ 194 */
1463 HWND handle = hWnd; 1486 HWND handle = hWnd;
1464 1487
1465 /* Get the entryfield handle from multi window controls */ 1488 /* Get the entryfield handle from multi window controls */
1466 if(strncmp(tmpbuf, "#2", 3)==0) 1489 if(strncmp(tmpbuf, "#2", 3)==0)
1467 handle = WinWindowFromID(hWnd, 667); 1490 handle = WinWindowFromID(hWnd, 667);
1468 if(strncmp(tmpbuf, "#32", 4)==0)
1469 handle = WinWindowFromID(hWnd, 1703);
1470 1491
1471 if(handle) 1492 if(handle)
1472 { 1493 {
1473 switch(command) 1494 switch(command)
1474 { 1495 {
1588 WinSendMsg(hWnd, msg, mp1, MPFROM2SHORT(pos, SB_SLIDERPOSITION)); 1609 WinSendMsg(hWnd, msg, mp1, MPFROM2SHORT(pos, SB_SLIDERPOSITION));
1589 } 1610 }
1590 break; 1611 break;
1591 } 1612 }
1592 return _entryproc(hWnd, msg, mp1, mp2); 1613 return _entryproc(hWnd, msg, mp1, mp2);
1614 }
1615
1616 /* Handle special messages for the spinbutton's entryfield */
1617 MRESULT EXPENTRY _spinentryproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
1618 {
1619 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER);
1620 PFNWP oldproc = 0;
1621
1622 if(blah)
1623 oldproc = blah->oldproc;
1624
1625 switch(msg)
1626 {
1627 case WM_CONTEXTMENU:
1628 case WM_COMMAND:
1629 return _entryproc(hWnd, msg, mp1, mp2);
1630 }
1631
1632 if(oldproc)
1633 return oldproc(hWnd, msg, mp1, mp2);
1634
1635 return WinDefWindowProc(hWnd, msg, mp1, mp2);
1593 } 1636 }
1594 1637
1595 int _dw_int_pos(HWND hwnd) 1638 int _dw_int_pos(HWND hwnd)
1596 { 1639 {
1597 int pos = (int)dw_window_get_data(hwnd, "_dw_percent_value"); 1640 int pos = (int)dw_window_get_data(hwnd, "_dw_percent_value");
4043 NULLHANDLE, 4086 NULLHANDLE,
4044 HWND_TOP, 4087 HWND_TOP,
4045 id, 4088 id,
4046 NULL, 4089 NULL,
4047 NULL); 4090 NULL);
4091 HWND entry = _find_entryfield(tmp);
4048 dw_window_set_font(tmp, DefaultFont); 4092 dw_window_set_font(tmp, DefaultFont);
4049 blah->oldproc = WinSubclassWindow(tmp, _entryproc); 4093 blah->oldproc = WinSubclassWindow(tmp, _entryproc);
4050 WinSetWindowPtr(tmp, QWP_USER, blah); 4094 WinSetWindowPtr(tmp, QWP_USER, blah);
4095 blah = calloc(sizeof(WindowData), 1);
4096 blah->oldproc = WinSubclassWindow(entry, _spinentryproc);
4097 WinSetWindowPtr(entry, QWP_USER, blah);
4051 return tmp; 4098 return tmp;
4052 } 4099 }
4053 4100
4054 /* 4101 /*
4055 * Create a new radiobutton window (widget) to be packed. 4102 * Create a new radiobutton window (widget) to be packed.