B4J Question [ABMaterial] Solved: footer height

udg

Expert
Licensed User
Longtime User
Hi all,

please have a look at the attached screenshot. I'd like to build a footer made up of a button and a label.
As you can see, below the useful area it's shown a gap (whose color tells me that it's part of the footer); more, button and label shows different heights.
The code I experimented with so far is:
B4X:
Sub BuildFooterFixed   
   page.isFixedFooter= True
   'because we have a fixed footer at the bottom, we have To adjust the padding of the body in pixels
   page.PaddingTop = 5
   page.PaddingBottom = 5
   
   page.Footer.AddRows(1, False, "").AddCellsOS(1,0,0,0,6,3,1,"").AddCellsOS(1,0,0,0,6,9,11, "xxy")  
   page.Footer.BuildGrid 'IMPORTANT once you loaded the complete grid And before you start adding components   
   
   page.Footer.UseTheme("footertheme")

   page.Footer.Cell(1,1).PaddingLeft =0
   page.Footer.Cell(1,1).PaddingTop =0
   page.Footer.Cell(1,1).PaddingBottom =0
   page.Footer.Cell(1,1).MarginBottom=0
   
   page.Footer.Cell(1,2).PaddingLeft =0
   page.Footer.Cell(1,2).PaddingTop =0
   page.Footer.Cell(1,2).PaddingBottom =0
   page.Footer.Cell(1,2).MarginBottom=0

   Dim btnStart As ABMButton
   btnStart.InitializeRaised(page, "btn1", "", ABM.CELL_ALIGN_CENTER, "Button", "bstartth")
   btnStart.Size=ABM.SIZE_H6
   page.Footer.Cell(1,1).AddComponent(btnStart)

   Dim lbl2 As ABMLabel
   lbl2.Initialize(page, "footlbl2", "My message to the user",ABM.SIZE_H6, False, "whitefc")
   page.Footer.Cell(1,2).AddComponent(lbl2)   

   page.Footer.Cell(1,1).SetFixedHeight(30)   'no effect
   page.Footer.Cell(1,2).SetFixedHeight(30)   'no effect
End Sub
[code]

Note: as long it has a click event, I could substitute the button with any other component (label, image..) that appears similar to the user.

Thank you for you help.
 

Attachments

  • MyFooter.png
    MyFooter.png
    2.4 KB · Views: 277

alwaysbusy

Expert
Licensed User
Longtime User
Your page.PaddingBottom = 5 is extremely small. This means the whole footer is only 5 pixels height. The 'padding' here means all the other content NOT in the footer. In your case you do not need page.PaddingTop

see what something like this gives (I cannot try it myself just now):

B4X:
Sub BuildFooterFixed()
  page.isFixedFooter= True
  page.PaddingBottom = 60

  page.Footer.AddRows(1, False, "").AddCellsOS(1,0,0,0,6,3,1,"").AddCellsOS(1,0,0,0,6,9,11, "xxy")
  page.Footer.BuildGrid

  Dim btnStart As ABMButton
  btnStart.InitializeRaised(page, "btn1", "", ABM.CELL_ALIGN_CENTER, "Button", "bstartth")
  btnStart.Size=ABM.SIZE_H6
  page.Footer.Cell(1,1).AddComponent(btnStart)

  Dim lbl2 As ABMLabel
  lbl2.Initialize(page, "footlbl2", "My message to the user",ABM.SIZE_H6, False, "whitefc")
  page.Footer.Cell(1,2).AddComponent(lbl2) 
End Sub
 
Upvote 0

udg

Expert
Licensed User
Longtime User
thank you for your immediate assistance. actually i'm on train to home so it will take me a few hours more to try your hint.
btw, i used paddingtop just to see its effect and because a previous larger value for paddingbottom seemed to have no effect ( it added a gap below my main grid and top of the footer)
anyway ley me try the revised code and report back.

thanks again
 
Upvote 0

udg

Expert
Licensed User
Longtime User
Hi all,
it took me a while but finally I came back to experiment with this excellent framework.
I solved the original problem simply using page.Footer.AddRowsM instead of page.Footer.AddRows.
New code reads now:
B4X:
Sub BuildFooterFixed()
   page.isFixedFooter= True
   'because we have a fixed footer at the bottom, we have To adjust the padding of the body in pixels
   page.PaddingBottom = 60
   
   page.Footer.AddRowsM(1,False,0,0,"").AddCellsOS(1,0,0,0,1,1,1,"xxx").AddCellsOS(1,0,0,0,11,11,11, "xxy")
   page.Footer.BuildGrid 'IMPORTANT once you loaded the complete grid And before you start adding components   
   
   page.Footer.UseTheme("footertheme")

   Dim btnStart As ABMButton
   btnStart.InitializeRaised(page, "btn1", "", ABM.CELL_ALIGN_CENTER, "Button", "bstartth")
   btnStart.Size=ABM.SIZE_H6
   page.Footer.Cell(1,1).AddComponent(btnStart)
   
   Dim lbl2 As ABMLabel
   lbl2.Initialize(page, "footlbl2", "My message to the user ",ABM.SIZE_H6, False, "whitefc")
   page.Footer.Cell(1,2).AddComponent(lbl2)   
End Sub
A small glitch is that Button and Label have different heights and since footer and label have different background colors this results in the attached screnshot.
I tried cells SetFixedHeight(40) but with no apparent result.

ps: page.PaddingBottom seems not related to the original problem since it looks to be the space below the last row of the main area grid (the one showing a series of identical icons).
udg
 

Attachments

  • Footer.png
    Footer.png
    6.3 KB · Views: 241
Upvote 0
Top