Mercurial > dwindows
diff win/dw.c @ 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 | 3573878d1239 |
children | c2013f1ef354 |
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);