B4J Question [ABMaterial] ABMUpload cann't put in the ABMcontainer

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi
version = 2.51

Its display correctly when I run your demo project. Why does it display incorrectly when i put ABMupload in the cell of ABMcontainer !?

above ABMContainer put in a list subitem.

list1.AddItemWithTheme("H2", BuildSimpleItem("L1H2","mdi-action-description",""),"")
list1.AddSubItem("H2", "S2", BuildItem1("L1H2S2","修改"))
page.Cell(1,1).AddComponent(list1)

bcaf005086de48f236451e398bad2164.png


B4X:
Dim mp1 As Map=db.RecipeLst.Get(recipedir)
            '
            Dim list1 As ABMList
            list1.Initialize(page, "list1", ABM.COLLAPSE_ACCORDION, "list1theme")
            list1.SubItemLeftPadding=16
            ' add items
            list1.AddItemWithTheme("H1", BuildSimpleItem("L1H1","mdi-action-description",recipedir),"")
            list1.AddSubItem("H1", "S1", BuildItem("L1H1S1","修改"))           
           
            list1.AddItemWithTheme("H2", BuildSimpleItem("L1H2","mdi-action-description",""),"")
            list1.AddSubItem("H2", "S2", BuildItem1("L1H2S2","修改"))
            page.Cell(1,1).AddComponent(list1)           

Sub BuildItem1(id As String, recipe As String) As ABMContainer
    Dim ItemCont As ABMContainer
    ItemCont.Initialize(page, id,"")
    ItemCont.AddRowsM(1,True,0,0,"").AddCellsOSMP(1,0,0,0,12,12,12,0,0,10,0,"")
    ItemCont.AddRowsM(1,True,0,0,"").AddCellsOSMP(1,0,0,0,4,4,4,6,0,0,0,"").AddCellsOSMP(1,0,0,0,8,8,8,6,0,0,0,"")
    ItemCont.AddRowsM(2,True,0,0,"").AddCellsOSMP(1,0,0,0,12,12,12,0,0,10,0,"")
    ItemCont.BuildGrid
    '
    Dim lbl As ABMLabel
    lbl.Initialize(page, id&"lbl1", "請輸入配方程序圖片", ABM.SIZE_H5, True, "")
    lbl.VerticalAlign=True
    ItemCont.Cell(1,1).AddComponent(lbl)
    '
    Dim upload1 As ABMUpload
    upload1.Initialize(page, "upload1", "Drop Here", "Browse", "upload")
    ItemCont.Cell(2,1).AddComponent(upload1)
    'page.Cell(6,1).AddComponent(upload1)
    ' create slider
    Dim slider As ABMImageSlider
    slider.Initialize(page, "slider", "")
    ' add images
    'slider.AddSlideImage("../images/slider1.jpg","This Is our big Title!", "Here's a small slogan.", ABM.IMAGESLIDER_LEFT)
    'slider.AddSlideImage("../images/slider2.jpg","This Is our big Title!", "Here's a small slogan.", ABM.IMAGESLIDER_CENTER)
    'slider.AddSlideImage("../images/slider3.jpg","This Is our big Title!", "Here's a small slogan.", ABM.IMAGESLIDER_RIGHT)
    'slider.AddSlideImage("../images/slider4.jpg","This Is our big Title!", "Here's a small slogan.", ABM.IMAGESLIDER_CENTER)
    ItemCont.Cell(2,2).AddComponent(slider)
   
    Dim lbl1 As ABMLabel
    lbl1.Initialize(page, id&"lbl1", "配方程序內容:", ABM.SIZE_H5, True, "")
    lbl1.VerticalAlign=True
    ItemCont.Cell(3,1).AddComponent(lbl1)
   
    Return ItemCont
End Sub
 

stanmiller

Active Member
Licensed User
Longtime User
Please post a link online so we can visit the site and inspect with the Chrome Debugger

Also please post how the site looks correctly vs incorrectly.
 
Upvote 0

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi

I move ABMUpload to page.cell and then PageNeedsUpload.Get(i) will be working !

B4X:
For i =0 To Pages.Size - 1
        srvr.AddWebSocket("/ws/" & ABMShared.AppName & "/" & Pages.Get(i) , Pages.Get(i))
        If PageNeedsUpload.Get(i) Then           
            srvr.AddHandler("/" & ABMShared.AppName & "/" & Pages.Get(i) & "/abmuploadhandler", "ABMUploadHandler", False)
        End If
    Next
 
Upvote 0

mindful

Active Member
Licensed User
This is a bug, it works if you add the ABMUpload component to a container which is added to the page, but if you add that container to a list as a subitem it produces visual error. See attached.

code used to replicate:
B4X:
    Dim y As ABMContainer
    y.Initialize(page, "containery", "")
    y.AddRowsM(1, False, 0, 0, "").AddCells12MP(1, 0, 0, 0, 0, "")
    y.BuildGrid
    Dim x As ABMUpload
    x.Initialize(page, "uploadx", "Drop Drop Drop", "Button Browse", "")
    y.Cell(1, 1).AddComponent(x)
    Dim z As ABMList
    z.Initialize(page, "listz", ABM.COLLAPSE_ACCORDION, "")
    z.SubItemLeftPadding = 16
    z.AddItem("listzitem1", ABMShared.BuildParagraph(page, "listitem1p", "item1"))
    z.AddSubItem("listzitem1", "listzitem1s1", y)
    page.Cell(1,1).AddComponent(z)

Please add it to the feedback app so @alwaysbusy can have a look and find a fix ...
 

Attachments

  • abmupload_problem.png
    abmupload_problem.png
    6.1 KB · Views: 260
Upvote 0
Top