# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1306043624 0 # Node ID 4d49504d76dd60cc534d0f9705d33b07bff38f97 # Parent cbac281970a9f78da4029ba77a94dbd63c7abeb9 Fix dw_window_get/set_text() on spinbuttons on Windows. diff -r cbac281970a9 -r 4d49504d76dd win/dw.c --- 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);