Implemented automatic date/time format changes for the date/time format date/time picker. Some diagnostic string updates in windows/tab.c as well.

This commit is contained in:
Pietro Gagliardi 2015-06-04 10:55:54 -04:00
parent 225248ecb8
commit 28656fc3d0
2 changed files with 20 additions and 3 deletions

View File

@ -100,8 +100,23 @@ uiDateTimePicker *finishNewDateTimePicker(DWORD style)
return uiDateTimePicker(d); return uiDateTimePicker(d);
} }
// Fortunately, because the date/time picker (on Vista, at least) does NOT respond to date/time format changes with its standard format styles, we only need to do this when creating the control as well. static LRESULT CALLBACK datetimepickerSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
// TODO really we need to send any WM_WININICHANGE messages back... {
switch (uMsg) {
case WM_WININICHANGE:
// we can optimize this by only doing it when the real date/time picker does it
// unfortunately, I don't know when that is :/
// hopefully this won't hurt
setDateTimeFormat(hwnd);
return 0;
case WM_NCDESTROY:
if (RemoveWindowSubclass(hwnd, datetimepickerSubProc, uIdSubclass) == FALSE)
logLastError("error removing date-time picker locale change handling subclass in datetimepickerSubProc()");
break;
}
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
}
uiDateTimePicker *uiNewDateTimePicker(void) uiDateTimePicker *uiNewDateTimePicker(void)
{ {
uiDateTimePicker *dtp; uiDateTimePicker *dtp;
@ -110,6 +125,8 @@ uiDateTimePicker *uiNewDateTimePicker(void)
dtp = finishNewDateTimePicker(0); dtp = finishNewDateTimePicker(0);
d = (struct datetimepicker *) dtp; d = (struct datetimepicker *) dtp;
setDateTimeFormat(d->hwnd); setDateTimeFormat(d->hwnd);
if (SetWindowSubclass(d->hwnd, datetimepickerSubProc, 0, (DWORD_PTR) d) == FALSE)
logLastError("error subclassing date-time-picker to assist in locale change handling in uiNewDateTimePicker()");
return dtp; return dtp;
} }

View File

@ -277,7 +277,7 @@ static LRESULT CALLBACK tabSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
return FALSE; return FALSE;
case WM_NCDESTROY: case WM_NCDESTROY:
if (RemoveWindowSubclass(hwnd, tabSubProc, uIdSubclass) == FALSE) if (RemoveWindowSubclass(hwnd, tabSubProc, uIdSubclass) == FALSE)
logLastError("error removing Tab resize handling subclass in tabSubProc()"); logLastError("error removing Tab tab stop handling subclass in tabSubProc()");
break; break;
} }
return DefSubclassProc(hwnd, uMsg, wParam, lParam); return DefSubclassProc(hwnd, uMsg, wParam, lParam);