Home | Info | Community | Development | myReactOS | Contact Us
[static]
Definition at line 310 of file updown.c.
Referenced by UPDOWN_DoAction(), and UpDownWindowProc().
{ static const WCHAR fmt_hex[] = { '0', 'x', '%', '0', '4', 'X', 0 }; static const WCHAR fmt_dec_oct[] = { '%', 'd', '\0' }; const WCHAR *fmt; WCHAR txt[20], txt_old[20] = { 0 }; int len; if (!((infoPtr->Flags & FLAG_BUDDYINT) && IsWindow(infoPtr->Buddy))) return FALSE; TRACE("set new value(%d) to buddy.\n", infoPtr->CurVal); /*if the buddy is a list window, we must set curr index */ if (UPDOWN_IsBuddyListbox(infoPtr)) { return SendMessageW(infoPtr->Buddy, LB_SETCURSEL, infoPtr->CurVal, 0) != LB_ERR; } /* Regular window, so set caption to the number */ fmt = (infoPtr->Base == 16) ? fmt_hex : fmt_dec_oct; len = wsprintfW(txt, fmt, infoPtr->CurVal); /* Do thousands separation if necessary */ if ((infoPtr->Base == 10) && !(infoPtr->dwStyle & UDS_NOTHOUSANDS) && (len > 3)) { WCHAR tmp[COUNT_OF(txt)], *src = tmp, *dst = txt; WCHAR sep = UPDOWN_GetThousandSep(); int start = len % 3; memcpy(tmp, txt, sizeof(txt)); if (start == 0) start = 3; dst += start; src += start; for (len=0; *src; len++) { if (len % 3 == 0) *dst++ = sep; *dst++ = *src++; } *dst = 0; } /* if nothing changed exit earlier */ GetWindowTextW(infoPtr->Buddy, txt_old, sizeof(txt_old)/sizeof(WCHAR)); if (lstrcmpiW(txt_old, txt) == 0) return 0; return SetWindowTextW(infoPtr->Buddy, txt); }