Android Question Side menu does not hide buttons

Omar Moreno

Member
Licensed User
Longtime User
Hi everyone.
To create the side menu, I am testing with B4XPages + B4XDrawer.
Question: Why are button objects only hidden when inside a Panel?
Look in the image, that the Menu button and the Test button are not hidden when the side menu is displayed:

1633123601967.png
1633123621598.png


I have attached a small example.

Thanks for your possible answers.
 

Attachments

  • B4XPag_P1.zip
    28.1 KB · Views: 206

bsnqt

Active Member
Licensed User
Longtime User
I have same issue with side menu (B4XDrawer). What I did is to put everything (including the button) on a panel and send it to back every time I show the Drawer (hope it can be a solution for you). But then there will be another issue: all views that are located around 5-10dip on the left edge will be "covered" by the Drawer (you can not "see" it) and are not responsive on touch or click.
 
Upvote 0

Omar Moreno

Member
Licensed User
Longtime User
Your code is wrong.
You need to load the main layout to Drawer.CenterPanel.
Thanks for answering.
I forgot to say that I had already done that test, but it causes the events of the objects to not work in their respective pages.
What do I need to make the events work?

B4XMainPage:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    'Root.LoadLayout("MainPage") '<- - - - - - -
    MIzq.Initialize(Me, Root, "MainPage", True)
    B4XPages.AddMenuItem(Me, "MENU")
End Sub

MenuIzq:
Public Sub Initialize(CallBackX As Object, Root As B4XView, IdPage As String, InicializarIdPages As Boolean)
    '
    Drawer.Initialize(CallBackX, "Drawer", Root, 300dip)
    Drawer.CenterPanel.LoadLayout(IdPage) '<- - - - - - -
    Drawer.LeftPanel.LoadLayout("MenuLeft")
    CargaItemMenu("1")
    '
    B4XPag1.Initialize
    If InicializarIdPages Then
        CargarIdPages
    End If
    '
End Sub
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I forgot to say that I had already done that test,
1. It is not a test, this is how you should use B4XDrawer.

2. If you are using multiple pages then don't try to use the same drawer in all pages. Create a new drawer in each page.

The layout events will be raised in the class where the layout was loaded.
If you want them to be raised in B4XMainPage then do something like:
B4X:
MIzq.Drawer.Center.LoadLayout("MainPageLayout")
 
Upvote 0

Omar Moreno

Member
Licensed User
Longtime User
1. It is not a test, this is how you should use B4XDrawer.

2. If you are using multiple pages then don't try to use the same drawer in all pages. Create a new drawer in each page.

The layout events will be raised in the class where the layout was loaded.
If you want them to be raised in B4XMainPage then do something like:
B4X:
MIzq.Drawer.Center.LoadLayout("MainPageLayout")
Erel, thank you very much for the explanation, now everything works correctly.
 
Upvote 0
Top