Android Question text button property ad array declaration

Oldmanenzo

Member
Licensed User
Longtime User
is possible to declare the text property of a button as an array???

i have this error
B4A version 4.30
Parsing code. 0.04
Compiling code. Error
Error compiling program.
Error description: Missing parameter.
Occurred on line: 59
Mese().Text =Array As String("Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic")
Word: (

and declaratione is this
B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private Mese(12) As Button
    Private img(2) As Bitmap
    Private Pnl As Panel
End Sub

assignment this

B4X:
Sub InitializeButton
    Dim timg As Int
    Dim index As Int = 5
    For n=0 To 11
        Mese(n).Initialize ("Mese")
        If n=0 Then
            Mese(n).SetBackgroundImage(img(0))
        Else
            Mese(n).SetBackgroundImage (img(1))
        End If
        Mese(n).Gravity =Bit.OR(Gravity.CENTER_HORIZONTAL, Gravity.CENTER_VERTICAL)
        Mese(n).Typeface =Typeface.DEFAULT_BOLD
        Mese(n).TextSize =20
        Mese(n).TextColor =Colors.White
        Mese(n).Tag =n
        Pnl.AddView (Mese(n),index, 5dip, 100dip, 40dip)
        index=index +105dip
    Next
    Mese().Text =Array As String("Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic")

but this assignmente work fine

B4X:
'    Mese(0).Text="Gen."
'    Mese(1).Text ="Feb."
'    Mese(2).Text ="Mar."
'    Mese(3).Text="Apr."
'    Mese(4).Text ="Mag."
'    Mese(5).Text ="Giu."
'    Mese(6).Text="Lug."
'    Mese(7).Text ="Ago."
'    Mese(8).Text ="Set."
'    Mese(9).Text="Ott."
'    Mese(10).Text ="Nov."
'    Mese(11).Text ="Dic."
End Sub
 

Similar Threads

Top