[3.0] Clear input focus when Return/Escape key Up 29/115429/2
authorminho.sun <minho.sun@samsung.com>
Mon, 20 Feb 2017 02:20:43 +0000 (11:20 +0900)
committerminho.sun <minho.sun@samsung.com>
Mon, 20 Feb 2017 04:46:51 +0000 (13:46 +0900)
Make TextField and TextEditor cleare it's input focus when getting Return/Escape KeyUp event.

Change-Id: Idc9318ab2a7a25aeaf92e750377c97edfd27e929
Signed-off-by: minho.sun <minho.sun@samsung.com>
dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp

index af42883..4b5dcfa 100644 (file)
@@ -1228,7 +1228,12 @@ bool TextEditor::OnKeyEvent( const KeyEvent& event )
 
   if( Dali::DALI_KEY_ESCAPE == event.keyCode ) // Make a Dali key code for this
   {
-    ClearKeyInputFocus();
+    // Make sure ClearKeyInputFocus when only key is up
+    if( event.state == KeyEvent::Up )
+    {
+      ClearKeyInputFocus();
+    }
+
     return true;
   }
 
index c8e2ed2..482032c 100644 (file)
@@ -1403,10 +1403,13 @@ bool TextField::OnKeyEvent( const KeyEvent& event )
 {
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnKeyEvent %p keyCode %d\n", mController.Get(), event.keyCode );
 
-  if( Dali::DALI_KEY_ESCAPE == event.keyCode ||
-      "Return" == event.keyPressedName ) // Make a Dali key code for this
+  if( Dali::DALI_KEY_ESCAPE == event.keyCode || "Return" == event.keyPressedName ) // Make a Dali key code for this
   {
-    ClearKeyInputFocus();
+    // Make sure ClearKeyInputFocus when only key is up
+    if( event.state == KeyEvent::Up )
+    {
+      ClearKeyInputFocus();
+    }
     return true;
   }