B4J Question How to bring a Pane "ToFront" [solved!]

Didier9

Well-Known Member
Licensed User
Longtime User
A number of widgets have a BringToFront property, the Pane does not have one.
I have added buttons on a form after I added the pane, and now the buttons are above the pane and showing up.
I have not found a way to make them go back.
I could make them invisible (and visible again when I remove the pane) but there must be a better way...
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
The z index is managed by the designer. In the designer put the node you want in the back at the first position of the views tree

If you are doing it by code then remove the view from its parent and add it again it should be now Infront
 
Upvote 0

Didier9

Well-Known Member
Licensed User
Longtime User
Enrique, my savior!
Thank you so much, I did not know the Tree View actually shows the zOrder...
It is actually convenient but I had completely missed it.
Enjoy coffee on my account!
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
I'm posting this here as a way to determine Z-order at runtime in B4J that I haven't seen in the forum. I had a similar problem and found that all Jafa FX nodes have a toFront and toBack method that can easily be invoked using a JavaObject.

B4X:
    Private cvs As Canvas
    Dim cvsjo As JavaObject

   ...

    cvs.Initialize("")
    pnlBackground.AddView(cvs, 0, 0, cvsSize, cvsSize)
 
    ...

    cvsjo = cvs
    cvsjo.RunMethod("toFront", Null)
 
Upvote 0
Top