Hi I am creating an array of buttons and trying to individually select the text of a button that has been pressed. I have tried the 'sender' option and that will only show me that last number in the array regardless of which button I click on. I have tried the button tag and the button id nothing work. What am I doing wrong, please help.
The code (it's not the total code) I am using is below
The code (it's not the total code) I am using is below
B4X:
Cntr = 0
offsetY = 125
offsetX = 40
Width = 40
Height = 30
Dim Done As Boolean
Done = False
For y = 0 To DaysInMonth - 1
If y = 0 Then
For x = 7 - FirstNode To 6
Cntr = Cntr + 1
b.Initialize("b")
MainForm.RootPane.AddNode(b, offsetX + x * (Width + 5dip), offsetY, Width, Height)
b.Font = fx.DefaultFont(14)
b.Text = Cntr
b.Tag = Cntr
b.Id = Cntr
Next
Else
For x = 0 To 6
Cntr = Cntr + 1
b.Initialize("b")
MainForm.RootPane.AddNode(b, offsetX + x * (Width + 5dip), offsetY + y * (Height + 5dip), Width, Height)
b.Font = fx.DefaultFont(14)
b.Text = Cntr
b.Tag = Cntr
b.Id = Cntr
If Cntr = DaysInMonth Then
Done = True
Exit
End If
Next
End If
If Done = True Then Exit
Next
B4X:
Private Sub b_MouseClicked (EventData As MouseEvent)
Dim bb As Button
bb = Sender
Log(bb.Id)
msgbox.Show(EventData,"")
End Sub