B4J Question [ABMaterial] Raised button setup

Rob White

Member
Licensed User
Hi all,
I want to set up a series of buttons as a menu. I want all the buttons the same width and in two columns.
I used code like this :-
B4X:
    But1.InitializeRaised(page,"but1","","","FULL + SetBx","mytheme")        ' FullWidth+SetBord
    But1.UseFullCellWidth = True
    But1.SetBorderEx(ABM.COLOR_RED,ABM.INTENSITY_ACCENT4,3,ABM.BORDER_SOLID,"20px")
    
    page.Cell(2,1).AddComponent(But1)
but the button is not full with of the cell.

I have setup the following test program.

B4X:
public Sub BuildPage()
    ' initialize the theme
    BuildTheme
    
    ' initialize this page using our theme
    page.InitializeWithTheme(Name, "/ws/" & ABMShared.AppName & "/" & Name, False, ABMShared.SessionMaxInactiveIntervalSeconds, theme)
    page.ShowLoader=True
    page.PageHTMLName = "index.html"
    page.PageTitle = "Add chems to list"
    page.PageDescription = ""
    page.PageKeywords = ""
    page.PageSiteMapPriority = ""
    page.PageSiteMapFrequency = ABM.SITEMAP_FREQ_YEARLY
        
    page.ShowConnectedIndicator = True
                
    ' adding a navigation bar
    ' ABMShared.BuildNavigationBar(page, "My Page","../images/logo.png", "", "", "")
    page.AddRows(1,True,"").AddCells12(1,"")
    page.AddRows(2,True,"").AddCellsOS(1,0,0,0,3,3,3,"").AddCellsOS(1,1,1,1,3,3,3,"")

    page.BuildGrid 'IMPORTANT once you loaded the complete grid AND before you start adding components
End Sub

public Sub ConnectPage()           
    '    connecting the navigation bar
    ' ABMShared.ConnectNavigationBar(page)
    
    Dim lab As ABMLabel
    Dim But1 As ABMButton
    Dim But2 As ABMButton
    Dim But3 As ABMButton
    Dim But4 As ABMButton
    
    lab.Initialize(page,"lab","Button testing",ABM.SIZE_H5,False,"mytheme")
    
    But1.InitializeRaised(page,"but1","","","FULL + SetBx","mytheme")        ' FullWidth+SetBord
    But1.UseFullCellWidth = True
    But1.SetBorderEx(ABM.COLOR_RED,ABM.INTENSITY_ACCENT4,3,ABM.BORDER_SOLID,"20px")
    
    But2.InitializeRaised(page,"but2","","","Reversed","mytheme")
    But2.SetBorderEx(ABM.COLOR_RED,ABM.INTENSITY_ACCENT4,3,ABM.BORDER_SOLID,"20px")   
    But2.UseFullCellWidth = True
    
    But3.InitializeRaised(page,"but3","","","FullWidth Only","mytheme")
    But3.UseFullCellWidth = True
    
    But4.InitializeRaised(page,"but4","","","BorderEx Only","mytheme")
    But4.SetBorderEx(ABM.COLOR_RED,ABM.INTENSITY_ACCENT4,3,ABM.BORDER_SOLID,"20px")
    
    page.Cell(1,1).AddComponent(lab)
    page.Cell(2,1).AddComponent(But1)
    page.Cell(2,2).AddComponent(But2)
    page.Cell(3,1).AddComponent(But3)
    page.Cell(3,2).AddComponent(But4)

    ' refresh the page
    page.Refresh
    
    ' Tell the browser we finished loading
    page.FinishedLoading
    ' restoring the navigation bar position
    page.RestoreNavigationBarPosition   
End Sub

Here are the buttons:-

Why are all but button4 should be full with of the cell and have rounded corners and red borders in my mind.
Why is this not working?
 

Harris

Expert
Licensed User
Longtime User
Wierd. Seems set full width is only respected when set border ex is not used...
Seems i have struggled with this before and cant recall any resolve at the moment..
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…