B4J Question ABMModalSheet with Fixed Footer

walterf25

Expert
Licensed User
Longtime User
Hi all, i've been away for a while and just recently got back to playing around with B4X, I am working on a web app but I can't remember if is even possible to create a fixed footer on an ABMModalSheet. Here's the relevant code.

B4J:
Sub createmodalsheet(params() As UPSHistory) As ABMModalSheet
    Dim myModal As ABMModalSheet
'''    Dim chrono As ABMChronologyList
    myModal.Initialize(page, "upshistory", False, False ,"mymodal")
    myModal.Content.UseTheme("mymdal")  '''modalcontent
    myModal.Footer.UseTheme("modalfooter")   '''modalfooter
    myModal.IsDismissible = False
   
    ' create the grid for the content
    myModal.Content.AddRowsM(2,True,  -10, 0,"").AddCells12MP(1, 0,0,0,0,"centre")
    myModal.Content.BuildGrid 'IMPORTANT once you loaded the complete grid AND before you start adding components
   
    ' add paragraph
    myModal.Content.Cell(1,1).AddComponent(ABMShared.BuildParagraphBQWithZDepth(page,"par1","UPS Tracking Information for " & trackingNumber) )

    chrono.Clear
    Dim clrs() As String = Array As String("red", "blue", "green")
    For i = 0 To params.Length - 1
    Dim random As Int
    random = Rnd(0, 3)
    Dim clr As String = clrs(random)
    Log("color: " & clr)
    If params(i).Description.Contains("Delivered") Then
        clr = "green"
    else if params(i).Description.Contains("Out For Delivery") Then
        clr = "blue"
    Else
        clr = "yellow"
    End If
    chrono.AddSlide("slide"&(i+1), BuildFiche((i+1), params(i).time, params(i).Date, params(i).Description, "", clr), clr)
    Next
'''    chrono.Refresh
    Try
        Dim comp As ABMChronologyList = myModal.Content.Cell(2,1).Component("chrono")
        Log("component id: " & comp.ID)
    Catch
        Log("component doesn't exist yet, let's create it..")
        myModal.Content.Cell(2, 1).AddComponent(chrono)
    End Try

    '''myModal.Footer.AddRowsM2(1, True, 0, 0, 330, 330, "").AddCells12MP(1, 0, 0, 20, 20, "mymodal")
    myModal.Footer.AddRows(1,True,"").AddCellsOS(1,5,5,5,2,2,2,"")
    '''mymodal.Footer.BuildGrid ' IMPORTANT!
    '''myModal.Footer.SetFixedPosition("0 px", "500 px", "0 px", "600 px")
    myModal.Footer.BuildGrid 'IMPORTANT once you loaded the complete grid AND before you start adding components
   
'''    chrono.Refresh
   
    ' create the button for the footer
    Dim msbtn1 As ABMButton
    msbtn1.InitializeFlat(page, "closeupstracking", "", "", "Close", "footerbutton")
    myModal.Footer.Cell(1,1).AddComponent(msbtn1)
   
    chrono.Refresh
   
    Return myModal
End Sub

All I need is to be able to set a fixed footer so that when I scroll up or down the footer stays at the same position and won't move along with the rest of the content.
 

Attachments

  • upload.png
    upload.png
    140.3 KB · Views: 141

walterf25

Expert
Licensed User
Longtime User
Hi Walter,

Change the FixedFooter parameter in the MyModal.Initialize to True:

B4X:
myModal.Initialize(page, "upshistory", True, False ,"mymodal")

Alwaysbusy
Of course, like I said, I have been away from B4X for quite some time, I couldn't remember this simple answer.

Thanks again.
 
Upvote 0
Top