changeset 1028:4d49504d76dd

Fix dw_window_get/set_text() on spinbuttons on Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 22 May 2011 05:53:44 +0000
parents cbac281970a9
children 60d6d2c87116
files win/dw.c
diffstat 1 files changed, 23 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Sat May 21 06:09:48 2011 +0000
+++ b/win/dw.c	Sun May 22 05:53:44 2011 +0000
@@ -5793,6 +5793,12 @@
    /* Combobox */
    if ( strnicmp( tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1) == 0 )
       SendMessage(handle, CB_SETEDITSEL, 0, MAKELPARAM(-1, 0));
+   else if ( strnicmp( tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1) == 0 )
+   {
+      ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA);
+      if( cinfo && cinfo->buddy )
+         SetWindowText( cinfo->buddy, text );
+   }
    else if ( strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1) == 0 )
    {
       /* groupbox */
@@ -5811,8 +5817,23 @@
  */
 char * API dw_window_get_text(HWND handle)
 {
-   int len = GetWindowTextLength(handle);
-   char *tempbuf = calloc(1, len + 2);
+   char tmpbuf[100], *tempbuf;
+   int len;
+
+   GetClassName(handle, tmpbuf, 99);
+   
+   if ( strnicmp( tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1) == 0 )
+   {
+      ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA);
+      
+      if( cinfo && cinfo->buddy )
+        handle = cinfo->buddy;
+      else
+        return NULL;
+   }
+   
+   len = GetWindowTextLength(handle);
+   tempbuf = calloc(1, len + 2);
 
    GetWindowText(handle, tempbuf, len + 1);