comctl32: Process WM_CHAR instead of WM_KEYDOWN for numbers in datetime.
This commit is contained in:
parent
93aed4b078
commit
40bbe3da6f
|
@ -902,6 +902,57 @@ DATETIME_KeyDown (DATETIME_INFO *infoPtr, DWORD vkCode)
|
|||
FIXME ("Callbacks not implemented yet\n");
|
||||
}
|
||||
|
||||
switch (vkCode) {
|
||||
case VK_ADD:
|
||||
case VK_UP:
|
||||
DATETIME_IncreaseField (infoPtr, fieldNum, 1);
|
||||
DATETIME_SendDateTimeChangeNotify (infoPtr);
|
||||
break;
|
||||
case VK_SUBTRACT:
|
||||
case VK_DOWN:
|
||||
DATETIME_IncreaseField (infoPtr, fieldNum, -1);
|
||||
DATETIME_SendDateTimeChangeNotify (infoPtr);
|
||||
break;
|
||||
case VK_HOME:
|
||||
DATETIME_IncreaseField (infoPtr, fieldNum, INT_MIN);
|
||||
DATETIME_SendDateTimeChangeNotify (infoPtr);
|
||||
break;
|
||||
case VK_END:
|
||||
DATETIME_IncreaseField (infoPtr, fieldNum, INT_MAX);
|
||||
DATETIME_SendDateTimeChangeNotify (infoPtr);
|
||||
break;
|
||||
case VK_LEFT:
|
||||
do {
|
||||
if (infoPtr->select == 0) {
|
||||
infoPtr->select = infoPtr->nrFields - 1;
|
||||
wrap++;
|
||||
} else {
|
||||
infoPtr->select--;
|
||||
}
|
||||
} while ((infoPtr->fieldspec[infoPtr->select] & DT_STRING) && (wrap<2));
|
||||
break;
|
||||
case VK_RIGHT:
|
||||
do {
|
||||
infoPtr->select++;
|
||||
if (infoPtr->select==infoPtr->nrFields) {
|
||||
infoPtr->select = 0;
|
||||
wrap++;
|
||||
}
|
||||
} while ((infoPtr->fieldspec[infoPtr->select] & DT_STRING) && (wrap<2));
|
||||
break;
|
||||
}
|
||||
|
||||
InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static LRESULT
|
||||
DATETIME_Char (DATETIME_INFO *infoPtr, WPARAM vkCode, LPARAM keyData)
|
||||
{
|
||||
int fieldNum = infoPtr->select & DTHT_DATEFIELD;
|
||||
|
||||
if (vkCode >= '0' && vkCode <= '9') {
|
||||
/* this is a somewhat simplified version of what Windows does */
|
||||
SYSTEMTIME *date = &infoPtr->date;
|
||||
|
@ -978,49 +1029,6 @@ DATETIME_KeyDown (DATETIME_INFO *infoPtr, DWORD vkCode)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (vkCode) {
|
||||
case VK_ADD:
|
||||
case VK_UP:
|
||||
DATETIME_IncreaseField (infoPtr, fieldNum, 1);
|
||||
DATETIME_SendDateTimeChangeNotify (infoPtr);
|
||||
break;
|
||||
case VK_SUBTRACT:
|
||||
case VK_DOWN:
|
||||
DATETIME_IncreaseField (infoPtr, fieldNum, -1);
|
||||
DATETIME_SendDateTimeChangeNotify (infoPtr);
|
||||
break;
|
||||
case VK_HOME:
|
||||
DATETIME_IncreaseField (infoPtr, fieldNum, INT_MIN);
|
||||
DATETIME_SendDateTimeChangeNotify (infoPtr);
|
||||
break;
|
||||
case VK_END:
|
||||
DATETIME_IncreaseField (infoPtr, fieldNum, INT_MAX);
|
||||
DATETIME_SendDateTimeChangeNotify (infoPtr);
|
||||
break;
|
||||
case VK_LEFT:
|
||||
do {
|
||||
if (infoPtr->select == 0) {
|
||||
infoPtr->select = infoPtr->nrFields - 1;
|
||||
wrap++;
|
||||
} else {
|
||||
infoPtr->select--;
|
||||
}
|
||||
} while ((infoPtr->fieldspec[infoPtr->select] & DT_STRING) && (wrap<2));
|
||||
break;
|
||||
case VK_RIGHT:
|
||||
do {
|
||||
infoPtr->select++;
|
||||
if (infoPtr->select==infoPtr->nrFields) {
|
||||
infoPtr->select = 0;
|
||||
wrap++;
|
||||
}
|
||||
} while ((infoPtr->fieldspec[infoPtr->select] & DT_STRING) && (wrap<2));
|
||||
break;
|
||||
}
|
||||
|
||||
InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1341,6 +1349,9 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
case WM_KEYDOWN:
|
||||
return DATETIME_KeyDown (infoPtr, wParam);
|
||||
|
||||
case WM_CHAR:
|
||||
return DATETIME_Char (infoPtr, wParam, lParam);
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
return DATETIME_KillFocus (infoPtr, (HWND)wParam);
|
||||
|
||||
|
|
Loading…
Reference in New Issue