iOS Question B4Xdrawer and SafeAreaInsets

marcick

Well-Known Member
Licensed User
Longtime User
I have a PnlRoot that contains the main layout and the resize event works fine with IphoneX

B4X:
Private Sub PageMain_Resize(Width As Int, Height As Int)
    Dim r As Rect = PageMain.SafeAreaInsets
    PnlRoot.SetLayoutAnimated(0, 1, r.Left, r.Top, Width - r.Right - r.Left, Height - r.Bottom - r.Top)   
End Sub

But when I add the code to implement the B4XDrawer (based on this tutorial), I have a wrong graphics behaviour.
It seems the Drawer.Centerpanel that contains the main layout doesn't shift correctly so I see two layout one over the other and with different offsets
Where I'm wrong ?

I tried this

B4X:
Private Sub PageMain_Resize(Width As Int, Height As Int)
    Dim r As Rect = PageMain.SafeAreaInsets
    Drawer.Resize(Width - r.Right - r.Left, Height - r.Bottom - r.Top)
    PnlRoot.SetLayoutAnimated(0, 1, r.Left, r.Top, Width - r.Right - r.Left, Height - r.Bottom - r.Top)   
End Sub
 

marcick

Well-Known Member
Licensed User
Longtime User
Well, it depends on what you have decided to show in the corner ....
For my layout I prefer the rootpanel is shrinked to fit the safe area.
I realize I can lower the widht of the drawer not to occupy the right rounded corner area, but I can't shift left the drawer not to occupy the left notch and I have instead to shift right the graphics in the drawer.leftpanel
After one weeks of attempts my personal conclusion (without anybody feels offended) is that I don' like the drawer as it behaves in B4i. Also it is missing the drawer.rightpanel that would complete this solution. It was present in the older sliding panels (but it was suggested to me to switch to B4xDrawer). Better (for me) to use a simple anotherpage.show without troubles ..... the animation is similar to that one of the drawer.
Thank you very much for your support :)
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
wow ... right panel makes a big difference. I'm focused now on another part but I'll come back and give it a try.
Thanks !
 
Upvote 0
Top