changeset 156:63258b34e70d

Minor changes.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 08 Nov 2002 17:38:59 +0000
parents 840c54766306
children a07dd2e819f3
files os2/dw.c
diffstat 1 files changed, 49 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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;
 }