From 6d306df109b452d8f03bc28180b56bf38fd4ed2d Mon Sep 17 00:00:00 2001 From: huiyueun <35286162+huiyueun@users.noreply.github.com> Date: Wed, 10 Jan 2018 21:16:30 +0900 Subject: [PATCH] [Tizen.NUI]Fix bug about Children property. (#23) Signed-off-by: huiyu,eun --- src/Tizen.NUI/src/public/BaseComponents/View.cs | 33 +++++++++++++++++++++---- src/Tizen.NUI/src/public/Layer.cs | 17 +++++++++---- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index bd51f9b..d66053c 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -49,11 +49,18 @@ namespace Tizen.NUI.BaseComponents /// 4 public override void Add(View child) { - NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - - Children.Add(child); + Container oldParent = child.Parent; + if(oldParent != this) + { + if (oldParent != null) + { + oldParent.Remove(child); + } + NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Children.Add(child); + } } /// @@ -3701,6 +3708,22 @@ namespace Tizen.NUI.BaseComponents } } + + /// + /// [Obsolete("Please do not use! this will be deprecated. Please use Visibility instead.")] + /// + /// 3 + [Obsolete("Please do not use! This will be deprecated! Please use Visibility instead!")] + [EditorBrowsable(EditorBrowsableState.Never)] + public bool Visible + { + get + { + return IsVisible(); + } + } + + /// /// Gets the view's world color. /// diff --git a/src/Tizen.NUI/src/public/Layer.cs b/src/Tizen.NUI/src/public/Layer.cs index 3a4b84d..ab65d84 100755 --- a/src/Tizen.NUI/src/public/Layer.cs +++ b/src/Tizen.NUI/src/public/Layer.cs @@ -49,11 +49,18 @@ namespace Tizen.NUI /// 4 public override void Add(View child) { - NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - - Children.Add(child); + Container oldParent = child.GetParent(); + if (oldParent != this) + { + if (oldParent != null) + { + oldParent.Remove(child); + } + NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Children.Add(child); + } } /// -- 2.7.4