B4J Question How to clear previous loaded layout with transparent panes

ThRuST

Well-Known Member
Licensed User
Longtime User
I need to clear previous loaded layout in the background when loading a new one since the previous layout leaves graphics garbage in the corners when loading a new layout that uses a rounded layout similar to a Surfpad.
How can I clear all previously loaded layouts to have the underlying graphics cleared? Cheers
 

stevel05

Expert
Licensed User
Longtime User
Well, that depends on where you loaded the layout in the first place. Either Form.RootPane.RemoveAllNodes, or Pane.RemoveAllNodes before loading the new layout. should do it.
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
Hi :) I used this

B4X:
MainForm.RootPane.LoadLayout("Panel") 'Load the layout file.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Then do
MainForm.RootPane.RemoveAllNodes, before loading a new layout.
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
Hmm it still leavs white corners. Might have to change the mainform style.

Strange it should work with this

B4X:
MainForm = Form1
    MainForm.SetFormStyle("TRANSPARENT")
    MainForm.RootPane.LoadLayout("Panel_Menu") 'Load the layout file.
    MainForm.Show

Transp1.jpg
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
It looks like you set the corner-radius, but not the background-radius.
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
B4X:
CSSUtils.SetStyleProperty(MainForm.RootPane,"-fx-background-radius","15px")
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
Hmm Thanks Daestrum I tried that after loading the new layout but it still got those white corners. Perhaps corner radius like Steve said.
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
No, still white
tried -fx-corner-radius as well.
Please attach a little sample project that solve it. Then I can make it work :)
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Sorry my mistake (had a white background on screen so never saw corners properly)
This works for me
B4X:
…
 asJO(MainForm).GetFieldJO("scene").RunMethod("setFill",Array(fx.Colors.Transparent))
End Sub
Sub asJO(o As JavaObject)As JavaObject
 Return o
End Sub
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
Damn I can't live without you guys :rolleyes: See how beautiful it looks, even though I will add a dark gradient to make the edges less sharp. This looks promising indeed.
Every detail is important in a project, and I'm able to pass every step along the way because of this forum. Thank you so much Steve and Daestrum :)

Transp2.jpg
 
Upvote 0
Top