Nuno Durães Member Jan 21, 2023 #1 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: Copy 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
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: Copy 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 Jan 21, 2023 #2 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
Most likely width and height don't settle until the the UI is fully rendered. It's better to use prefWidth and prefHeight
Nuno Durães Member Jan 21, 2023 #3 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
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
Nuno Durães Member Jan 21, 2023 #4 EnriqueGonzalez said: Most likely width and height don't settle until the the UI is fully rendered. It's better to use prefWidth and prefHeig Click to expand... EnriqueGonzalez said: Most likely width and height don't settle until the the UI is fully rendered. It's better to use prefWidth and prefHeight Click to expand... Followed most carefully your suggestion and now is working . Thank you Upvote 0
EnriqueGonzalez said: Most likely width and height don't settle until the the UI is fully rendered. It's better to use prefWidth and prefHeig Click to expand... EnriqueGonzalez said: Most likely width and height don't settle until the the UI is fully rendered. It's better to use prefWidth and prefHeight Click to expand... Followed most carefully your suggestion and now is working . Thank you
teddybear Well-Known Member Licensed User Jan 21, 2023 #5 Nuno Durães said: 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: Copy 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 Click to expand... Where and how do you define and initialize the pane P? Upvote 0
Nuno Durães said: 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: Copy 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 Click to expand... Where and how do you define and initialize the pane P?
Nuno Durães Member Jan 21, 2023 #6 Nuno Durães said: 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 Click to expand... teddybear said: Where and how do you define and initialize the pane P? Click to expand... Already fixed. Thank you so much Upvote 0
Nuno Durães said: 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 Click to expand... teddybear said: Where and how do you define and initialize the pane P? Click to expand... Already fixed. Thank you so much
Erel B4X founder Staff member Licensed User Longtime User Jan 22, 2023 #7 Tip: you should never see Pane, PrefWidth and PrefHeight in your code. Code: Copy Dim pnl As B4XView = XUI.CreatePanel("pnl") pnl.SetLayoutAnimated(0, ...) 'not really needed as you should add the panel to the parent at this point. pnl.Rotation = 45 ... Upvote 0
Tip: you should never see Pane, PrefWidth and PrefHeight in your code. Code: Copy Dim pnl As B4XView = XUI.CreatePanel("pnl") pnl.SetLayoutAnimated(0, ...) 'not really needed as you should add the panel to the parent at this point. pnl.Rotation = 45 ...
Nuno Durães Member Jan 22, 2023 #8 Erel said: Tip: you should never see Pane, PrefWidth and PrefHeight in your code. Code: Copy Dim pnl As B4XView = XUI.CreatePanel("pnl") pnl.SetLayoutAnimated(0, ...) 'not really needed as you should add the panel to the parent at this point. pnl.Rotation = 45 ... Click to expand... 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
Erel said: Tip: you should never see Pane, PrefWidth and PrefHeight in your code. Code: Copy Dim pnl As B4XView = XUI.CreatePanel("pnl") pnl.SetLayoutAnimated(0, ...) 'not really needed as you should add the panel to the parent at this point. pnl.Rotation = 45 ... Click to expand... 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?