javauis/lcdui_akn/lcdui/src/CMIDTextEditorEdwin.cpp
branchRCL_3
changeset 23 e5618cc85d74
parent 21 4376525cdefb
--- a/javauis/lcdui_akn/lcdui/src/CMIDTextEditorEdwin.cpp	Mon Jun 21 15:32:50 2010 +0300
+++ b/javauis/lcdui_akn/lcdui/src/CMIDTextEditorEdwin.cpp	Thu Jul 15 18:31:06 2010 +0300
@@ -156,7 +156,14 @@
         response = HandleSpecialKeyEventsL(aKeyEvent, aType);
 
         // Not handled, try with CEikEdwin
-        if (response == EKeyWasNotConsumed)
+        // Consume down and up type of keyevents
+        if ((response == EKeyWasConsumed) || 
+                (aType != EEventKey && aKeyEvent.iScanCode != 
+                EStdKeyApplication0))
+        {
+            response = EKeyWasConsumed;
+        }
+        else
         {
             // Old text is needed if the new content is not valid for the
             // given set of constraints. This validation is made because
@@ -171,16 +178,31 @@
             CleanupStack::PushL(oldContent);
 
             response = CEikEdwin::OfferKeyEventL(aKeyEvent, aType);
-
-            // Validate new content and undo if not valid.
-            if (!iEdwinUtils.ConstraintsValidForText(
-                        Read(), iConstraints, EFalse))
-            {
-                CEikEdwin::SetTextL(oldContent);
-                // Notify about text change.
-                HandleTextChangedL();
-                // Restore cursor's original position.
-                SetCursorPosL(iCursorPosForAction, EFalse);
+            
+            if (response == EKeyWasConsumed) {
+                // Validate new content and undo if not valid.
+                if (!iEdwinUtils.ConstraintsValidForText(
+                            Read(), iConstraints, EFalse))
+                {
+                    CEikEdwin::SetTextL(oldContent);
+                    // Notify about text change.
+                    HandleTextChangedL();
+                    // Restore cursor's original position.
+                    SetCursorPosL(iCursorPosForAction, EFalse);
+                }
+            }
+            else
+            { 
+                // Consuming the up/down arrows, because edwin does not 
+                // consume them if at first/last line. 
+                if ((aType == EEventKey) &&
+                        (((aKeyEvent.iCode == EKeyUpArrow) ||
+                          (aKeyEvent.iCode == EKeyDownArrow)) ||
+                         ((aKeyEvent.iScanCode == EStdKeyUpArrow) ||
+                          (aKeyEvent.iScanCode == EStdKeyDownArrow))))
+                {
+                    response = EKeyWasConsumed;
+                }
             }
             CleanupStack::PopAndDestroy(oldContent);
         }
@@ -548,7 +570,7 @@
 //
 void CMIDTextEditorEdwin::HandleResourceChange(TInt aType)
 {
-    CCoeControl::HandleResourceChange(aType);
+    CEikEdwin::HandleResourceChange(aType);
     // Notification about language change
     if (aType == KEikInputLanguageChange)
     {