[NUI] Remove Child in Layout View using RemoveChild func (#1542)
authorneostom432 <31119276+neostom432@users.noreply.github.com>
Tue, 14 Apr 2020 06:42:06 +0000 (15:42 +0900)
committerGitHub <noreply@github.com>
Tue, 14 Apr 2020 06:42:06 +0000 (15:42 +0900)
Previously, Remove child manually so missing few steps.
Now, use RemoveChild func for removing.

src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs

index e8862e9..c138812 100755 (executable)
@@ -106,10 +106,16 @@ namespace Tizen.NUI
                     {
                         if(childLayout.Owner != null)
                         {
-                            Interop.Actor.Actor_Remove(View.getCPtr(childLayout.Owner.Parent), View.getCPtr(childLayout.Owner));
-                            if (NDalicPINVOKE.SWIGPendingException.Pending)
-                                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                            childLayout.Owner.InternalParent = null;
+                            View parent = childLayout.Owner.GetParent() as View;
+
+                            if(parent != null)
+                            {
+                                parent.RemoveChild(childLayout.Owner);
+                            }
+                            else
+                            {
+                                NUIApplication.GetDefaultWindow().Remove(childLayout.Owner);
+                            }
                         }
                     }
 
@@ -119,11 +125,13 @@ namespace Tizen.NUI
                     childRemoved = true;
                 }
             }
+
             if (childRemoved)
             {
                 // If child removed then set all siblings not being added to a ChangeOnRemove transition.
                 SetConditionsForAnimationOnLayoutGroup(TransitionCondition.ChangeOnRemove);
             }
+
             RequestLayout();
         }