B4J Question [ABMaterial] strange bug in ABMInput (INPUT_TEXTALIGN_CENTER) ?

rbirago

Active Member
Licensed User
Longtime User
I continue my ABMaterial trials and sometimes I found something strange:
I have tried to use an ABMInput disabled to make use of the autolabeled feature of ABMInput.
Being only-disp fields I tried the ABM.INPUT_TEXTALIGNED_CENTER option.
The result is different than expected:
snapshot.png

This is the code I added to the standard Standard Template Project:
B4X:
Sub ConnectPage()


    ' See the ABMPageTemplate for the tutorial!

    
    ABMShared.ConnectNavigationBar(page)
    ' add header
    page.Cell(1,1).AddComponent(ABMShared.BuildLabel(page,  "hdr1",  "About / Help Landing Page", ABM.SIZE_H3, "",0,""))
    page.Cell(3,1).AddComponent(ABMShared.BuildLabel(page,  "hdr2",  "Not much to see here... Click on 'Template Page' in Navigation Bar!", ABM.SIZE_H5, "",0,""))
    page.Cell(5,1).AddComponent(ABMShared.BuildLabel(page,  "hdr3",  "NOTE: Currently, Only About and Template In The Nav Bar Expose Any Pages!", ABM.SIZE_H5, "lbltheme2",0,""))
    
    'test
    Dim txFie61, txFie62, txFie71, txFie72 As ABMInput
    txFie61.Initialize(page,"txFie61",ABM.INPUT_text,"field 61",False,"")
    txFie61.Enabled = False
    txFie61.Text = "1234567890"
    page.Cell(6,1).AddComponent(txFie61)
    txFie62.Initialize(page,"txFie62",ABM.INPUT_text,"field 62",False,"")
    txFie62.Enabled = False
    txFie62.Text = "1234567890 1234567890 1234567890"
    page.Cell(6,2).AddComponent(txFie62)
    txFie71.Initialize(page,"txFie71",ABM.INPUT_TEXTALIGN_CENTER,"field 71",False,"")
    txFie71.Enabled = False
    txFie71.Text = "1234567890"
    page.Cell(7,1).AddComponent(txFie71)
    txFie72.Initialize(page,"txFie72",ABM.INPUT_TEXTALIGN_CENTER,"field 72",False,"")
    txFie72.Enabled = False
    txFie72.Text = "1234567890 1234567890 1234567890"
    page.Cell(7,2).AddComponent(txFie72)
    
    page.Refresh ' IMPORTANT
 
    ' NEW, because we use ShowLoaderType=ABM.LOADER_TYPE_MANUAL
    page.FinishedLoading 'IMPORTANT   
    
End Sub

public Sub BuildPage()
    ' initialize the theme
    BuildTheme
    page.InitializeWithTheme(Name, "/ws/" & ABMShared.AppName & "/" & Name, False, ABMShared.SessionMaxInactiveIntervalSeconds, theme)
    
    ' show the spinning cicles while page is loading....
    page.ShowLoader=True
    page.PageHTMLName = "index.html"
    page.PageTitle = ""  ' You can also set this as a property in "ABMShared.BuildNavigationBar" below...
    
    '  Google SEO stuff...
    page.PageDescription = ""
    page.PageKeywords = ""
    page.PageSiteMapPriority = ""
    page.PageSiteMapFrequency = ABM.SITEMAP_FREQ_YEARLY
        
    ' faint green dot (on title bar) when connected - red when not connected with web socket
    page.ShowConnectedIndicator = True
    
    ABMShared.BuildNavigationBar(page, "My {B} About Page {/B} ", "../images/logo.png",  "",  "",  "")
    
    page.AddRowsM( 5, True, 0, 10, "").AddCellsOSMP( 1, 0, 0, 0, 12, 12, 12, 0,  0, 0, 0, "")

    page.AddRows(2,True,"").AddCellsOSMP(2,0,0,0,6,6,6,0,0,0,0,"")

    'IMPORTANT - Build the Grid before you start adding components ( with ConnectPage()!!! )
    page.BuildGrid
    
End Sub
As you can see the option works different than expected, but the boxed result should be nice if setted with a proper command and sized correctly.
Someone can help me?
thank you.
Roberto
 

Cableguy

Expert
Licensed User
Longtime User
I am not sure I understand your issue.
If a you try to achieve is a boxed label, then look for SetBorderEx property
 
Upvote 0

rbirago

Active Member
Licensed User
Longtime User
I try to explain better:
I was only trying to center the text. The param INPUT_TEXTALIGN_CENTER gives this strange result as you can see in the example.
At the same time this strange result is interesting and now you suggest to me to use this SetBorderEx....but is this an ABMInput property or a cell property? I have not found it!
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
It is a ABMLabel property but you can also use similar and apply to cell.
Search for "themming the framework " in the forum
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
Dim txFie61, txFie62, txFie71, txFie72 As ABMInput
Not sure if an Input field has same theme properties?

Label.
This is a label theme property.... (" lbltheme2 " )

B4X:
    tmpTheme.AddLabelTheme("lbltheme2")
    tmpTheme.Label("lbltheme2").ForeColor = ABM.COLOR_BLUE
    tmpTheme.Label("lbltheme2").FontWeight = 300
    tmpTheme.Label("lbltheme2").ForeColorIntensity = ABM.INTENSITY_DARKEN4
    tmpTheme.Label("lbltheme2").BackColor = ABM.COLOR_TEAL
    tmpTheme.Label("lbltheme2").BackColorIntensity = ABM.INTENSITY_LIGHTEN3
    tmpTheme.Label("lbltheme2").Align = ABM.TEXTALIGN_CENTER
 
Last edited:
Upvote 0
Top