Hello,
Using the B4XDrawer with B4XPage raises a question I like to ask. If we need only one Drawer as a central main Menu I do not like to implement the drawer subs/code in each B4XPage again and again. In a B4XPage Project the Idea is to implement the drawer not on each Page but one level higher on Activity level (Main). Ist that possible? Is there are better way? How?
1. Implement it in the main activity. This will only work in B4A.
2. Implement it in a class and create a class instance on each of the pages. Example here: https://www.b4x.com/android/forum/threads/138771/#content
The second option will require some additional work to make it cross platform but it should be possible to do.
Ok thank you. To implement it in the main is what I prefer. I tried it but run into problem.
Activity create:
Drawer.Initialize(Me,"Drawer",Me,400dip) ' this wrong and raises an error
'Drawer.CenterPanel.LoadLayout("MainPage")
Drawer.LeftPanel.LoadLayout("MainMenu")
To initialize the drawer I understand to set the callback to Me but what is the correct reference to set for the 2nd it's a b4xview I do'nt have it in Main.
The next is what to load? LeftPanel is the Drawer OK, but the central panel? SHould it be the B4XMainPage?
Sorry, I know that this is wrong! It was only an example. If you let it run you get the error dat the 2nd Me is not accepted because the Me is pointing to an activity and not to an B4XView.
Sorry, I know that this is wrong! It was only an example. If you let it run you get the error dat the 2nd Me is not accepted because the Me is pointing to an activity and not to an B4XView.
' Two subs in the drawer
Public Sub getLeftOpen As Boolean
Return IsOpen
End Sub
Public Sub setLeftOpen (b As Boolean)
If b = IsOpen Then Return
Dim x As Float
If b Then x = 0 Else x = -mSideWidth
ChangeOffset(x, False, False)
End Sub