iOS Question Convert button creation from B4A to B4I

Discussion in 'iOS Questions' started by Giusy, Aug 12, 2018.

  1. Giusy

    Giusy Active Member Licensed User

    Hi, in B4A I create buttons programmatically with this code
    Code:
    Dim x, y As Int
      
    For y = 0 To ROWs-1
       
    For x = 0 To columns - 1
        
    Dim bt As Button
        bt.Initialize(
    "Button")                                                                    ERROR 1
        strLines =list1.get(y)
        bt.Text = strLines
        bt.Tag = y*columns
        bt.Typeface= 
    Typeface.DEFAULT_BOLD                                         ERROR 2
        bt.TextSize=
    20                                                                           ERROR 3
        bt.SingleLine=
    True                                                                      ERROR 4
        bt.textcolor= 
    Colors.RGB(0,0,128)                                                ERROR 5
        bt.Gravity = 
    Bit.Or(Gravity.LEFT, Gravity.CENTER_VERTICAL)         ERROR 6

        ScreenScrollView.Panel.AddView(bt, x*BWidth,y*BHeight+
    2dip,BWidth,BHeight-4dip)  'Add Button
              
         
    Next
      
    Next
    In B4I i get SIX error. :(
    How can I replace incorrect instructions?

    thanks to those who want to give me help :)
     
  2. Filippo

    Filippo Expert Licensed User

    That's just a small example.
    Code:
    Dim btn As Button
        btn.Initialize(
    "btn", btn.STYLE_SYSTEM)
        btn.CustomLabel.Font = 
    Font.CreateNew(28)
        btn.Text = 
    "Button"
     
    Giusy likes this.
  3. Giusy

    Giusy Active Member Licensed User

    Hi @Filippo
    Thanks ... now error 1 and error 3 are ok, but the others?
     
  4. Giusy

    Giusy Active Member Licensed User

    error 5 correct in bt.CustomLabel.TextColor= Colors.RGB(0,0,128)

    error 2 - 4 - 6 not resolved
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    2. Use Font.CreateNewBold.
    4. Probably not needed
    6.
    Code:
    btn.CustomLabel.TextAlignment = btn.CustomLabel.ALIGNMENT_LEFT
     
    Giusy likes this.
  6. Giusy

    Giusy Active Member Licensed User

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice