Hello, I use a calendar and when I click on a special day I load all the activity create this day. I would like to create X label ( if I have 5 activity I create 5 label) And when I click on a label I would like to show all the information about this activity. I already have everything but I don't know how to create the labels with _Click function for each label. How can I do that ?
Hirogens,
If I understand your question correctly. You were asking how to handle events from an unknown number of views that are created in code.
The way I would do this is to create all of the labels with the same event handler. I would then use the tag on each label to hold an identifier for each created label.
B4X:
' Create the labels
For i = 0 To numberoflabels
lbl.Initialize("CreatedLabels")
lbl.Tag = i
' Code to place label in Activity etc
Next
then
B4X:
Sub CreatedLabels_click
Private lbl As Label = Sender
Private clickedLabel As Int = lbl.Tag
Log("Clicked Label "& clickedLabel)
End Sub
If you need to store more data against each label you can store a map in the tag which could then have an ID field.