[Tizen] Oring key event callback result 57/132857/1
authorminho.sun <minho.sun@samsung.com>
Thu, 8 Jun 2017 04:21:24 +0000 (13:21 +0900)
committerminho.sun <minho.sun@samsung.com>
Thu, 8 Jun 2017 04:21:24 +0000 (13:21 +0900)
Oring key event callback result.

Currently, when user add many callbacks to one view's key event, the last
callback result is became key event result.(Even if one of callback returns true)

Now, if one of callback returns true, the result of key event is true
via Oring callback result.

Change-Id: I38c90c06b4232aeb557cb5219e63d64fb9d6e7f5
Signed-off-by: minho.sun <minho.sun@samsung.com>
Tizen.NUI/src/public/BaseComponents/View.cs

index f9d4e8f..c0cb5b9 100755 (executable)
@@ -218,15 +218,23 @@ namespace Tizen.NUI.BaseComponents
         {
             KeyEventArgs e = new KeyEventArgs();
 
+            bool result = false;
+
             e.Key = Tizen.NUI.Key.GetKeyFromPtr(keyEvent);
 
             if (_keyEventHandler != null)
             {
-                return _keyEventHandler(this, e);
+                Delegate[] delegateList = _keyEventHandler.GetInvocationList();
+
+                // Oring the result of each callback.
+                foreach ( EventHandlerWithReturnType<object, KeyEventArgs, bool> del in delegateList )
+                {
+                    result |= del( this, e );
+                }
             }
-            return false;
-        }
 
+            return result;
+        }
 
         private EventHandler _onRelayoutEventHandler;
         [UnmanagedFunctionPointer(CallingConvention.StdCall)]