iOS Question Rootpanel from a CustomView

D

Deleted member 103

Guest
Hi,

I have to find the Rootpanel from my own CustomView.

This is my solution that works in my case.
The question is whether it works everywhere and if not, if there may be a better solution?


B4X:
Public Sub DesignerCreateView (Base As Panel, lbl As Label, Props As Map)
    mBase.Value = Base
    ...
    myRootPanel = getRootPanel(Base)
    
    myRootPanel.AddView(pnlBackground, 0, 0, myRootPanel.Width, myRootPanel.Height)
    ...
End Sub

Private Sub getRootPanel(Base As Panel) As View
    Dim v As View = Base.Parent
    Do While v.Width > 0
        v = v.Parent
    Loop
    Return v
End Sub
 
D

Deleted member 103

Guest
Unfortunately, it is not that easy, or I do not know how it should work.
Here is the error message:

 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…