bool
_DateTimePresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
{
- int boxId = 0;
-
if (!__keypadEnabled)
{
return false;
_KeyCode keyCode = keyInfo.GetKeyCode();
- if (__focusedBoxIndex < __outputBoxMaxCount)
- {
- boxId = __pDisplayBox[__focusedBoxIndex]->GetDisplayBoxId();
-
- if ((keyCode != _KEY_RIGHT) && (keyCode != _KEY_LEFT) && (keyCode != _KEY_TAB) && (boxId == DATETIME_ID_MONTH))
- {
- //month can be changed only with touch on input pad
- return true;
- }
- }
-
switch (keyCode)
{
case _KEY_RIGHT:
else if (boxId == DATETIME_ID_MONTH)
{
PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_SIP, __pView);
- newNumber = inputPadReturnValue;
- __inputComposing = DATETIME_INPUT_BEGIN;
+
+ if (__inputComposing == DATETIME_INPUT_BEGIN && __keypadEnabled)
+ {
+ currentNumber = GetNumberInBox(boxId);
+ newNumber = currentNumber * 10 + inputPadReturnValue;
+
+ if (newNumber > 12)
+ {
+ newNumber = 12;
+ }
+ else if (newNumber < 1)
+ {
+ newNumber = 1;
+ }
+
+ ChangeFocusBox();
+ }
+ else
+ {
+ if (inputPadReturnValue == 0)
+ {
+ return;
+ }
+ newNumber = inputPadReturnValue;
+ __inputComposing = DATETIME_INPUT_BEGIN;
+
+ if (!__keypadEnabled || newNumber > 1)
+ {
+ ChangeFocusBox();
+ }
+ }
SetNumberInBox(boxId, newNumber);
- ChangeFocusBox();
}
else
{