Private Sub Application_Start
Page1.Initialize("Page1")
Page1.RootPanel.LoadLayout("viewStartlogo") 'first time load a layout
NavControl.ShowPage(Page1)
Sleep(500)
ShowDrawer
End Sub
Private Sub ShowDrawer
Drawer.Initialize(Me, "Drawer", Page1.RootPanel, GetIdealDrawerWidth) 'only possible, if allready size known
Drawer.CenterPanel.LoadLayout("viewMain")
Drawer.LeftPanel.LoadLayout("viewMainLeft")
Dim bb As BarButton
bb.InitializeBitmap(LoadBitmapResize(File.DirAssets, "hamburger.png", 32dip, 32dip, True), "Drawer")
Page1.TopLeftButtons = Array(bb)
End Sub
Sub GetIdealDrawerWidth() As Int
Dim iWidth As Int = Min(Page1.RootPanel.Width, Page1.RootPanel.Height) ' Min(100%x, 100%y) 'if in Landscape mode
iWidth = iWidth - 40dip ' https://blog.sebastiano.dev/material-navigation-drawer-sizing/
Dim iMaxWidth As Int = 320dip : If iWidth > 500dip Then iMaxWidth = 400dip 'but max 320dp or 400dp with tablets
iWidth = Min(iWidth, iMaxWidth)
If iWidth <= 0 Then iWidth = 300dip 'if something went wrong
Return iWidth
End Sub