B4J Question ABMaterial

codie01

Active Member
Licensed User
Longtime User
Hi All,

Website going well, here's my next request for help.

I have created a Tab container across the website which can be viewed at http://104.238.77.163:51042/dweb/dweb_home/

I can see a ABM.Container is created under each TAB respectively with the following sub.Code

B4X:
' build the tabs container
Sub BuildTabContainer(id As String, Text As String) As ABMContainer
      Dim Tabc As ABMContainer
      Tabc.Initialize(page, id, "tabstheme")
      Tabc.AddRows(1,True, "").AddCells12(1,"")
    Tabc.BuildGrid
      Dim lbl As ABMLabel
    lbl.Initialize(page, id, id, ABM.SIZE_H5, True, "")
    Tabc.Cell(1,1).AddComponent(lbl)
    Return Tabc
End Sub

Then I return to the main.page and wish to build each TAB page in its own container. Yet I can not reference the rows or cells. The following is the page code with the point i wish to do this marked in blue.

B4X:
public Sub BuildPage()
    ' initialize the theme
    BuildTheme

    ' initialize this page using our theme
    page.InitializeWithTheme(Name, "/ws/" & AppName & "/" & Name, False, theme)
    page.ShowLoader=True
    page.SetBackgroundImage("../images/scafbackground.jpg")

    ' create the page grid
    page.AddRowsM( 1,True, 0, 0, "rowtheme").AddCellsOSMP(1,0,0,0,3,3,3,0,0,30,0,"").AddCellsOSMP(1,0,0,0,1,1,1,0,0,0,0,"").AddCellsOSMP(2,0,0,0,2,2,2,0,0,0,0,"").AddCellsOSMP(1,0,0,0,1,1,1,0,0,20,0,"").AddCellsOSMP(2,0,0,0,2,2,2,0,0,0,0,"whitefc").AddCellsOSMP(1,0,0,0,3,3,3,0,0,20,0,"")
    page.AddRowsM( 1,True, 0, 0, "rowtheme").AddCellsOSMP(1,0,0,0,3,3,3,0,0,30,0,"").AddCellsOSMP(1,0,0,0,1,1,1,0,0,0,0,"").AddCellsOSMP(2,0,0,0,2,2,2,0,0,0,0,"").AddCellsOSMP(1,0,0,0,1,1,1,0,0,40,0,"").AddCellsOSMP(2,0,0,0,2,2,2,0,0,0,0,"").AddCellsOSMP(1,0,0,0,3,3,3,0,0,0,20,"")
    page.AddRowsM( 1,True, 0, 0, "rowtheme").AddCellsOSMP(1,0,0,0,3,3,3,0,0,30,0,"").AddCellsOSMP(1,0,0,0,1,1,1,0,0,0,0,"").AddCellsOSMP(2,0,0,0,2,2,2,0,0,0,0,"").AddCellsOSMP(1,0,0,0,1,1,1,0,0,40,0,"").AddCellsOSMP(2,0,0,0,2,2,2,0,0,0,0,"").AddCellsOSMP(1,0,0,0,3,3,3,0,0,0,20,"")
    page.AddRowsM( 1,True, 0, 0, "rowtabtheme").AddCellsOSMP(1,0,0,0,1,1,1,0,0,10,0,"").AddCellsOSMP(1,0,0,0,6,6,6,0,0,0,0,"").AddCellsOSMP(1,0,0,0,1,1,1,0,0,0,0,"").AddCellsOSMP(2,0,0,0,2,2,2,0,0,0,0,"").AddCellsOSMP(2,0,0,0,2,2,2,0,0,80,20,"")
    'IMPORTANT once you loaded the complete grid AND before you start adding components
    page.BuildGrid

    ' load page images
    Dim img0 As ABMImage
    img0.Initialize(page, "img0","../images/linkdin.png",1)
    Dim img1 As ABMImage
    img1.Initialize(page, "img1","../images/logo.png",1)
    Dim img2 As ABMImage
    img2.Initialize(page, "img2","../images/freephone2.png",1)
    Dim img3 As ABMImage
    img3.Initialize(page, "img3","../images/shoppingcart.png",1)
    Dim img4 As ABMImage
    img4.Initialize(page, "img4","../images/nationwide.png",1)

    ' Build Header
    'row 1
    page.Cell(1,1).AddComponent(ABMShared.BuildHiddenParagraph(page, "par1", " "))
    page.Cell(1,2).AddComponent(ABMShared.BuildHiddenParagraph(page, "par1", " "))
    page.Cell(1,3).AddComponent(ABMShared.BuildHiddenParagraph(page, "par1", " "))
    page.Cell(1,4).AddComponent(img0)
    page.Cell(1,5).AddComponent(ABMShared.BuildHiddenParagraph(page, "par1", " "))
    page.Cell(1,6).AddComponent(img2)
    'row 2
    page.Cell(2,1).AddComponent(img1)
    page.Cell(2,2).AddComponent(ABMShared.BuildHiddenParagraph(page, "par1", " "))
    page.Cell(2,3).AddComponent(ABMShared.BuildHiddenParagraph(page, "par1", " "))
    page.Cell(2,4).AddComponent(ABMShared.BuildHiddenParagraph(page, "par1", " "))
    page.Cell(2,5).AddComponent(img3)
    page.Cell(2,6).AddComponent(ABMShared.BuildParagraph(page, "par1", "ORDER CART #0"))
    'row 3
    page.Cell(3,1).AddComponent(ABMShared.BuildHiddenParagraph(page, "par1", " "))
    page.Cell(3,2).AddComponent(ABMShared.BuildHiddenParagraph(page, "par1", " "))
    page.Cell(3,3).AddComponent(ABMShared.BuildHiddenParagraph(page, "par1", " "))
    page.Cell(3,4).AddComponent(ABMShared.BuildHiddenParagraph(page, "par1", " "))
    page.Cell(3,5).AddComponent(ABMShared.BuildHiddenParagraph(page, "par1", " "))
    page.Cell(3,6).AddComponent(ABMShared.BuildHiddenParagraph(page, "par1", " "))
    'Build TABS
    'create tabs
    Dim tabs As ABMTabs
    tabs.Initialize(page, "tabs", "tabstheme")

    'create the tabs As ABMContainer.
    tabs.AddTab("tab1", "HOME", BuildTabContainer("tab1", "t1"),3,3,3,12,12,12,True,True)
    tabs.AddTab("tab2", "PRODUCTS", BuildTabContainer("tab2", "t2"),3,3,3,12,12,12,True,True)
    tabs.AddTab("tab3", "ABOUT", BuildTabContainer("tab3", "t3"),3,3,3,12,12,12,True,True)
    tabs.AddTab("tab4", "MY ACCOUNT", BuildTabContainer("tab4", "t4"),3,3,3,12,12,12,True,True)

    'add to cells in row 4
    page.Cell(4,1).AddComponent(ABMShared.BuildHiddenParagraph(page, "par1", " "))
    page.Cell(4,2).AddComponent(tabs)
    page.Cell(4,3).AddComponent(ABMShared.BuildHiddenParagraph(page, "par1", " "))
    page.Cell(4,4).AddComponent(ABMShared.BuildHiddenParagraph(page, "par1", " "))

    'create the home page
    ' add to each tab container here!

End Sub

As a side note: You will note to have each cell hold its space, I needed to fill it. in this case a space string.

I think the following code is correct, however it asks do I have a missing Library.

B4X:
page.ComponentRowCell(1,1,"tab1").AddComponent(ABMShared.BuildHiddenParagraph(page, "par1", " "))

Thanks Phil.
 

Harris

Expert
Licensed User
Longtime User
Try this as your space character: (with the quotes)
"{NBSP}"

By the way, that's a whack of scaffolding!
 
Last edited:
Upvote 0

codie01

Active Member
Licensed User
Longtime User
Hi Harris, whack?, Thanks I shall use "{NBSP}". By the way:

B4X:
page.ComponentRowCell(1,1,"tab1")

Gives no error so the problem looks like it is not complete in ABMaterial. I shall have to do it another way using the TABS. Do you know how I can build an event to detect which tab is clicked so i can load another page. I shall look myself but I am on a tight time line, so any advice is appreciated.

Regards P.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…