#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
Dim ControlLista As List
Dim ControlMapa As Map
Private Label1 As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Crea el ControlLista
ControlLista.Initialize
'Aqui puedes poner las caracteristicas (color, tamaño, texto...) de cada control.
ControlMapa.Initialize 'Caracteristicas del Label1
ControlMapa = CreateMap("Color":Colors.Blue,"ColorTexto":Colors.Yellow,"TamañoTexto":20,"Gravity":Gravity.CENTER,"Izq":5%x,"Arriba":5%y,"Ancho":90%x,"Alto":40%y)
ControlLista.Add(ControlMapa)
ControlMapa.Initialize 'Caracteristicas del boton 1
ControlMapa = CreateMap("Color":Colors.Blue,"ColorTexto":Colors.White,"TamañoTexto":10,"Tag":"a","Gravity":Gravity.BOTTOM,"Texto":"A","Izq":5%x,"Arriba":70%y,"Ancho":22%x,"Alto":10%y)
ControlLista.Add(ControlMapa)
ControlMapa.Initialize 'Caracteristicas del boton 2
ControlMapa = CreateMap("Color":Colors.Black,"ColorTexto":Colors.Blue,"TamañoTexto":18,"Tag":"a","Gravity":Gravity.CENTER,"Texto":"A1","Izq":28%x,"Arriba":70%y,"Ancho":22%x,"Alto":10%y)
ControlLista.Add(ControlMapa)
ControlMapa.Initialize 'Caracteristicas del boton 3
ControlMapa = CreateMap("Color":Colors.Cyan,"ColorTexto":Colors.Black,"TamañoTexto":8,"Tag":"a","Gravity":Gravity.CENTER_HORIZONTAL,"Texto":"Aa","Izq":51%x,"Arriba":70%y,"Ancho":22%x,"Alto":10%y)
ControlLista.Add(ControlMapa)
ControlMapa.Initialize 'Caracteristicas del boton 4
ControlMapa = CreateMap("Color":Colors.DarkGray,"ColorTexto":Colors.Yellow,"TamañoTexto":15,"Tag":"a","Gravity":Gravity.CENTER_VERTICAL,"Texto":"A3","Izq":74%x,"Arriba":70%y,"Ancho":22%x,"Alto":10%y)
ControlLista.Add(ControlMapa)
ControlMapa.Initialize 'Caracteristicas del boton 5
ControlMapa = CreateMap("Color":Colors.Transparent,"ColorTexto":Colors.Cyan,"TamañoTexto":10,"Tag":"b","Gravity":Gravity.FILL,"Texto":"B","Izq":5%x,"Arriba":81%y,"Ancho":22%x,"Alto":10%y)
ControlLista.Add(ControlMapa)
ControlMapa.Initialize 'Caracteristicas del boton 6
ControlMapa = CreateMap("Color":Colors.Blue,"ColorTexto":Colors.Red,"TamañoTexto":11,"Tag":"b","Gravity":Gravity.LEFT,"Texto":"BBB","Izq":28%x,"Arriba":81%y,"Ancho":22%x,"Alto":10%y)
ControlLista.Add(ControlMapa)
ControlMapa.Initialize 'Caracteristicas del boton 7
ControlMapa = CreateMap("Color":Colors.Red,"ColorTexto":Colors.Black,"TamañoTexto":12,"Tag":"b","Gravity":Gravity.NO_GRAVITY,"Texto":"bB","Izq":51%x,"Arriba":81%y,"Ancho":22%x,"Alto":10%y)
ControlLista.Add(ControlMapa)
ControlMapa.Initialize 'Caracteristicas del boton 8
ControlMapa = CreateMap("Color":Colors.Magenta,"ColorTexto":Colors.White,"TamañoTexto":13,"Tag":"b","Gravity":Gravity.LEFT,"Texto":"B1","Izq":74%x,"Arriba":81%y,"Ancho":22%x,"Alto":10%y)
ControlLista.Add(ControlMapa)
'Crea el Label1
ControlMapa = ControlLista.get (0)
Label1.Initialize("Label1")
Label1.Color = ControlMapa.Get("Color")
Label1.TextColor = ControlMapa.Get("ColorTexto")
Label1.TextSize = ControlMapa.Get("TamañoTexto")
Label1.Gravity = ControlMapa.Get("Gravity")
Activity.AddView(Label1,ControlMapa.Get("Izq"),ControlMapa.Get("Arriba"),ControlMapa.Get("Ancho"),ControlMapa.Get("Alto"))
'Crea los Button
For y = 1 To 8
ControlMapa = ControlLista.get (y)
Dim Boton As Button
Boton.Initialize("Button")
Boton.Color = ControlMapa.Get("Color")
Boton.TextColor = ControlMapa.Get("ColorTexto")
Boton.TextSize = ControlMapa.Get("TamañoTexto")
Boton.Tag = ControlMapa.Get("Tag")
Boton.Gravity = ControlMapa.Get("Gravity")
Boton.Text = ControlMapa.Get("Texto")
Activity.AddView(Boton,ControlMapa.Get("Izq"),ControlMapa.Get("Arriba"),ControlMapa.Get("Ancho"),ControlMapa.Get("Alto"))
Next
End Sub
Sub Button_Click
'despues de esto lo que quiero es al pulsar sobre unos de los botones con TAG="a" que solo Me triga en una variable el texto del boton y el tag
'ejemplo: click en Boton1 con el TAG="a"
'variable= Boton1.Text & "-" & Boton1.Tag
Dim variable As String
Dim Boton1 As Button
Boton1 = Sender
Select Boton1.Tag
Case "a"
variable = Boton1.Text & "-" & Boton1.Tag
Case "b"
variable = Boton1.Text & "+" & Boton1.Tag
End Select
Label1.Text = variable
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub