B4J Question Add pane at runtime

Hi everyone,
What am I doing wrong when to add a pane to rootpane?
It doesn't appear and logs 0 to with and height.

B4X:
CSSUtils.SetStyleProperty(p, "-fx-rotate","45" )
      
            
      MainForm.RootPane.AddNode(p,P.Left,P.Top,P.Width,P.Height)
      Log(P.Width & "    " & P.Height)
      P.Visible = True
      'xui.MsgboxAsync("Hello World!", "B4X")
End Sub
 

EnriqueGonzalez

Expert
Licensed User
Longtime User
Most likely width and height don't settle until the the UI is fully rendered. It's better to use prefWidth and prefHeight
 
Upvote 0
Thank you for your answer.
I did used that options for the size. What is the correct procedure to add pane to any pane at runtime.
Thanks in advance
 
Upvote 0

teddybear

Well-Known Member
Licensed User
Where and how do you define and initialize the pane P?
 
Upvote 0
Thanks Erel.
This is for the purpose of my learning:
can I assign mouse events to each panel using the respective tag as a filter in MainForm.RootPane.GetAllViewsRecursive, I mean without having to write a separate method for each panel?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…