B4J Question [ABMaterial] how to click on Logo and navigate to page "About" ?

giannimaione

Well-Known Member
Licensed User
Longtime User
usually we have a (same) logo on top-left on each page,but how to click on logo and navigate a same page example "About" ?
 

alwaysbusy

Expert
Licensed User
Longtime User
Just catch in each page the click on the logo.

You will have to add the logo as an object in the navigation bar like this:
B4X:
MyTheme.AddCellTheme("center")
MyTheme.Cell("center").Align = ABM.CELL_ALIGN_CENTER
MyTheme.Cell("center").VerticalAlign = True
...

Sub BuildNavigationBar(page As ABMPage, Title As String, logo As String, ActiveTopReturnName As String, ActiveSideReturnName As String, ActiveSideSubReturnName As String) 'ignore
    Dim sbtopcont As ABMContainer
    sbtopcont.Initialize(page, "sbtopcont", "")
    sbtopcont.AddRowsM(1, True, 0,0,"").AddCells12MP(1,0,-19,0,0, "center")
    sbtopcont.BuildGrid    
    
    Dim sbtopimg As ABMImage
    sbtopimg.Initialize(page, "sbtopimg", logo, 1)
    sbtopimg.SetFixedSize(151, 117)    
    sbtopcont.Cell(1,1).AddComponent(sbtopimg)
    
    page.NavigationBar.Initialize(page, "nav1", ABM.SIDEBAR_MANUAL_ALWAYSHIDE, Title, True, True, 325, 48, sbtopcont, ABM.COLLAPSE_ACCORDION, "onetwo")
    page.NavigationBar.TopBarHeightPx = 56
    page.NavigationBar.SideBarLogoHeight = 147
    page.NavigationBar.ActiveTopReturnName = ActiveTopReturnName
    page.NavigationBar.ActiveSideReturnName = ActiveSideReturnName
    page.NavigationBar.ActiveSideSubReturnName = ActiveSideSubReturnName
    page.NavigationBar.IsTextSelectable = False
    page.NavigationBar.SideBarSubItemsArrowAlignRight = True
    page.NavigationBar.forceFloatIconsLeft = True
            
    ' you must add at least ONE dummy item if you want to add items to the topbar    in ConnectNaviagationBar
    page.NavigationBar.AddTopItem("DUMMY", "{NBSP}", "", "", ABM.VISIBILITY_ALL)
    
    ' you must add at least ONE dummy item if you want to add items to the sidebar
    page.NavigationBar.AddSideBarItem("DUMMY", "{NBSP}", "", "")
End Sub

in each page add something like this:
B4X:
Sub sbtopimg_Clicked(Target As String)
    ABMShared.NavigateToPage(ws, ABMPageId, "../PageAbout")
End Sub

Alwaysbusy
 
Upvote 1
Top