B4J Question SideBarSubItem too big ?

jinyistudio

Well-Known Member
Licensed User
Longtime User
Following i embedd a component as sidebaritem with BuildSideBarComponent.
In the BuildSideBarComponent. I build one row in the ABMContainer. but its height is two row pls see the image. i have try to SetFixedHeight But useless. Why ? :(

B4X:
Sub ConnectNavigationBar(page As ABMPage) 'ignore      
    ' Clear the dummies we created in BuildNavigationBar
    page.NavigationBar.Clear      
    '
    Dim loginuser As Map=LogIn(page)
    Dim bool As Boolean=jylab.IIF(db.UdAccount(loginuser)<>"",True,False)
    ' add your navigationbar items          
    If bool Then      
        page.NavigationBar.AddSideBarItem("AddDevice", $"新增"$, "mdi-content-add-box", "")
        Dim dev As List=MyDB.DeviceLists
        If dev.Size>0 Then
            page.NavigationBar.AddSideBarItem("AllDev", $"所有"$, "mdi-action-explore", "")
            Dim n1 As Int=0
            For Each item As Map In dev
                Dim description As String=item.Get("description")
                Dim filename As String=item.Get("filename")
                Dim Protocol As String=item.Get("protocol")
                'page.NavigationBar.AddSideBarSubItem("AllDev","Dev"&n1,$"${description}{NBSP}{NBSP}({C:#000000}${Protocol}{/C})"$,"mdi-device-now-widgets",ProtocolUrl(Protocol,filename))
                page.NavigationBar.AddSideBarSubComponent("AllDev","Dev"&n1,BuildSideBarComponent(page,"DevCnt"&n1,description,Protocol),ProtocolUrl(Protocol,filename))
                n1=n1+1
            Next
        End If
        page.NavigationBar.AddSideBarItem("Logoff", $"登出 [ {B}{C:#000000}${loginuser.Get("account")}{/C}{/B} ]"$, "mdi-action-exit-to-app", "")      
    Else          
        page.NavigationBar.AddSideBarItem("Login",  "登 {C:#000000}Login{/C} 入", "mdi-action-exit-to-app", "")      
    End If
    page.NavigationBar.AddSideBarDivider
    page.NavigationBar.AddSideBarItem("About", "關 於 ...", "mdi-action-perm-identity", $"../about/index.html"$)
    page.NavigationBar.Refresh ' IMPORTANT
    'myMenu.Open
End Sub

B4X:
Public Sub BuildSideBarComponent(page As ABMPage, id As String, Title As String, Subtitle As String) As ABMContainer
    Dim ItemCont As ABMContainer
    ItemCont.Initialize(page, id, "")   
    '
    ItemCont.AddRowsM(1,False,0,0, "").AddCellsOSMP(1,0,0,0,8,8,8,0,0,0,0,"").AddCellsOSMP(1,0,0,0,4,4,4,0,0,0,0,"cell_right")
    ItemCont.BuildGrid 'IMPORTANT once you loaded the complete grid AND before you start adding components  
    Dim lbl1 As ABMLabel
    lbl1.Initialize(page, id & "lbl1", Title, ABM.SIZE_H6, False, "")
    lbl1.VerticalAlign = True
    ItemCont.Cell(1,1).AddComponent(lbl1)
    Dim lbl2 As ABMLabel
    lbl2.Initialize(page, id & "lbl2", $"{C:#FF0000}${Subtitle}{/C}"$, ABM.SIZE_H6, False, "")
    lbl2.VerticalAlign = True  
    ItemCont.Cell(1,2).AddComponent(lbl2)
    Return ItemCont
End Sub
 

Attachments

  • height.png
    height.png
    29.7 KB · Views: 184
Top