Mercurial > dwindows
comparison 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 |
comparison
equal
deleted
inserted
replaced
1027:cbac281970a9 | 1028:4d49504d76dd |
---|---|
5791 SetWindowText(handle, text); | 5791 SetWindowText(handle, text); |
5792 | 5792 |
5793 /* Combobox */ | 5793 /* Combobox */ |
5794 if ( strnicmp( tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1) == 0 ) | 5794 if ( strnicmp( tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1) == 0 ) |
5795 SendMessage(handle, CB_SETEDITSEL, 0, MAKELPARAM(-1, 0)); | 5795 SendMessage(handle, CB_SETEDITSEL, 0, MAKELPARAM(-1, 0)); |
5796 else if ( strnicmp( tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1) == 0 ) | |
5797 { | |
5798 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); | |
5799 if( cinfo && cinfo->buddy ) | |
5800 SetWindowText( cinfo->buddy, text ); | |
5801 } | |
5796 else if ( strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1) == 0 ) | 5802 else if ( strnicmp( tmpbuf, FRAMECLASSNAME, strlen(FRAMECLASSNAME)+1) == 0 ) |
5797 { | 5803 { |
5798 /* groupbox */ | 5804 /* groupbox */ |
5799 thisbox = (Box *)GetWindowLongPtr( handle, GWLP_USERDATA ); | 5805 thisbox = (Box *)GetWindowLongPtr( handle, GWLP_USERDATA ); |
5800 if ( thisbox && thisbox->grouphwnd != (HWND)NULL ) | 5806 if ( thisbox && thisbox->grouphwnd != (HWND)NULL ) |
5809 * Returns: | 5815 * Returns: |
5810 * text: The text associsated with a given window. | 5816 * text: The text associsated with a given window. |
5811 */ | 5817 */ |
5812 char * API dw_window_get_text(HWND handle) | 5818 char * API dw_window_get_text(HWND handle) |
5813 { | 5819 { |
5814 int len = GetWindowTextLength(handle); | 5820 char tmpbuf[100], *tempbuf; |
5815 char *tempbuf = calloc(1, len + 2); | 5821 int len; |
5822 | |
5823 GetClassName(handle, tmpbuf, 99); | |
5824 | |
5825 if ( strnicmp( tmpbuf, UPDOWN_CLASS, strlen(UPDOWN_CLASS)+1) == 0 ) | |
5826 { | |
5827 ColorInfo *cinfo = (ColorInfo *)GetWindowLongPtr(handle, GWLP_USERDATA); | |
5828 | |
5829 if( cinfo && cinfo->buddy ) | |
5830 handle = cinfo->buddy; | |
5831 else | |
5832 return NULL; | |
5833 } | |
5834 | |
5835 len = GetWindowTextLength(handle); | |
5836 tempbuf = calloc(1, len + 2); | |
5816 | 5837 |
5817 GetWindowText(handle, tempbuf, len + 1); | 5838 GetWindowText(handle, tempbuf, len + 1); |
5818 | 5839 |
5819 return tempbuf; | 5840 return tempbuf; |
5820 } | 5841 } |