B4J Question [BANano] Add SKTextBox by code

angel_

Well-Known Member
Licensed User
Longtime User
Is it possible to add a SKTextBox by code?

Tried this but can't get it to work:
B4X:
Dim btn as SKButton
btn.Initialize(me, "btn", "btn")
btn.Text = "Hello"
btn.Flavor = "button-danger"
btn.AddToParent("parentid")
 
Last edited:

angel_

Well-Known Member
Licensed User
Longtime User
I'm really not sure

B4X:
Sub BANano_Ready()
    ' Initialize your local browser database
    ' SQL.OpenWait("SQL", "MyDB")
    ' SQL.ExecuteWait("CREATE TABLE IF NOT EXISTS tTable (tblid INT, tblcode STRING, tbldesc STRING)", Null)

    ' get the body tag
    Private body As BANanoElement
    body.Initialize("#body")
   
    ' append and load our main layout
    body.Append($"<div id="mainHolder"></div>"$).Get("#mainHolder").LoadLayout("MainLayout")
    ' append and load a modal sheet
    body.Append($"<div id="modalHolder"></div>"$).Get("#modalHolder").LoadLayout("WelcomeModalLayout")
   
    ' loading our menu in our sidebar
    MainSidebar.Element.LoadLayout("MenuLayout")
   
    ' making the menu layout responsive: always open when screen size is bigger than 992px
    Bigger992px.Initialize("(min-width: 992px)")
    Smaller992px.Initialize("(max-width: 991px)")
   
    ' add our menu items  
    MenuList.AddMenuItem("", "page1", "fas fa-user", "{NBSP}{NBSP}Welcome page")
    MenuList.Start
       
    ' load our first page
    MainPageHolder.Element.LoadLayout("WelcomePageLayout")
   
    Dim btn As SKButton
    btn.Initialize(Me, "btn", "btn")
    btn.Text = "Hello"
    btn.Flavor = "button-danger"
    btn.AddToParent("parentid")
End Sub
 

Attachments

  • WelcomePageLayout.zip
    1.9 KB · Views: 125
Upvote 0

angel_

Well-Known Member
Licensed User
Longtime User
My idea was to add a SKLabel at the end of the SKTextBox, SKCombo... by code (as a suffix), because I think that you can't keep the label of the SKTextBox if I add a suffix.

Is it possible to do this?
 
Upvote 0
Top