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);
}
// 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.
// TODO really we need to send any WM_WININICHANGE messages back...
static LRESULT CALLBACK datetimepickerSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{
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 *dtp;
@ -110,6 +125,8 @@ uiDateTimePicker *uiNewDateTimePicker(void)
dtp = finishNewDateTimePicker(0);
d = (struct datetimepicker *) dtp;
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;
}

View File

@ -277,7 +277,7 @@ static LRESULT CALLBACK tabSubProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
return FALSE;
case WM_NCDESTROY:
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;
}
return DefSubclassProc(hwnd, uMsg, wParam, lParam);