LucaMs Expert Licensed User Longtime User Oct 11, 2020 #1 Mainly a "wish". View.Parent is read-only; can Anywhere Software set it as writable too? I'm "searching" "the" best way to share B4XViews between B4XPages. The ideal (just one line) would be: B4X: Copy ' my second B4XPage B4XPages.MainPage.MyView.Parent = Root
Mainly a "wish". View.Parent is read-only; can Anywhere Software set it as writable too? I'm "searching" "the" best way to share B4XViews between B4XPages. The ideal (just one line) would be: B4X: Copy ' my second B4XPage B4XPages.MainPage.MyView.Parent = Root
DonManfred Expert Licensed User Longtime User Oct 11, 2020 #2 You are posting this wish in the wrong forum. You can not change a Parent of a View. You need to remove the view from its parent and add it to the new parent. Erel has posted an Example somewhere. Upvote 0
You are posting this wish in the wrong forum. You can not change a Parent of a View. You need to remove the view from its parent and add it to the new parent. Erel has posted an Example somewhere.
LucaMs Expert Licensed User Longtime User Oct 11, 2020 #3 DonManfred said: You are posting this wish in the wrong forum. Click to expand... I know: LucaMs said: Mainly a "wish". Click to expand... DonManfred said: You can not change a Parent of a View. Click to expand... I know this too and the reason is because Parent is read-only. modViewsUtils - code module: B4X: Copy Public Sub MoveB4XView(xView As B4XView, Destination As B4XView) xView.RemoveViewFromParent Destination.AddView(xView, xView.Left, xView.Top, xView.Width, xView.Height) End Sub B4X: Copy Public Sub MoveB4XView2(xView As B4XView, Destination As B4XView, Left As Int, Top As Int, Width As Int, Height As Int) xView.RemoveViewFromParent Destination.AddView(xView, Left, Top, Width, Height) End Sub Last edited: Oct 11, 2020 Upvote 0
DonManfred said: You are posting this wish in the wrong forum. Click to expand... I know: LucaMs said: Mainly a "wish". Click to expand... DonManfred said: You can not change a Parent of a View. Click to expand... I know this too and the reason is because Parent is read-only. modViewsUtils - code module: B4X: Copy Public Sub MoveB4XView(xView As B4XView, Destination As B4XView) xView.RemoveViewFromParent Destination.AddView(xView, xView.Left, xView.Top, xView.Width, xView.Height) End Sub B4X: Copy Public Sub MoveB4XView2(xView As B4XView, Destination As B4XView, Left As Int, Top As Int, Width As Int, Height As Int) xView.RemoveViewFromParent Destination.AddView(xView, Left, Top, Width, Height) End Sub
LucaMs Expert Licensed User Longtime User Oct 11, 2020 #4 But those routines aren't ideal, though. Example: MyPage2 B4X: Copy Private Sub B4XPage_Created (Root1 As B4XView) Root = Root1 Root.LoadLayout("layTwo") modViewsUtils.MoveB4XView(B4XPages.MainPage.pnlBottom, Root) End Sub If then I need to move pnlBottom to MyPage3 I need to know that it is now in MyPag2. Upvote 0
But those routines aren't ideal, though. Example: MyPage2 B4X: Copy Private Sub B4XPage_Created (Root1 As B4XView) Root = Root1 Root.LoadLayout("layTwo") modViewsUtils.MoveB4XView(B4XPages.MainPage.pnlBottom, Root) End Sub If then I need to move pnlBottom to MyPage3 I need to know that it is now in MyPag2.
LucaMs Expert Licensed User Longtime User Oct 11, 2020 #5 So the question is: LucaMs said: View.Parent is read-only; can Anywhere Software set it as writable too? Click to expand... Upvote 0
So the question is: LucaMs said: View.Parent is read-only; can Anywhere Software set it as writable too? Click to expand...
LucaMs Expert Licensed User Longtime User Oct 11, 2020 #6 However, this was more a curiosity than a question or "wish", which came to my mind when replying to an Italian member. If I want to use the same View, even a complex one, I create a Custom View. Upvote 0
However, this was more a curiosity than a question or "wish", which came to my mind when replying to an Italian member. If I want to use the same View, even a complex one, I create a Custom View.
DonManfred Expert Licensed User Longtime User Oct 11, 2020 #7 No. This is how Android works. Anywheresoftware can not change Android-Rules. Upvote 0