Dynamic button click event

Brad

Active Member
Licensed User
Longtime User
Did some searching but couldn't find the answer. I'm testing adding dynamic buttons to a scrollview. They are being placed on the scrollview correctly but It's not capturing the click event. Any ideas?

B4X:
Sub Globals
        Dim SvActiveJobs As ScrollView
   Dim btnNotes As Button
end sub

.
.
.
Sub btnAdd_Click
   btnNotes.Initialize("")
   btnNotes.Text = "Test"
   btnNotes.Tag = DateTime.Time(DateTime.Now)
   svActiveJobs.Panel.AddView(btnNotes,5,iTop,50dip,50dip)
   iTop = iTop + 60
End Sub
.
.
.
Sub btnNotes_Click
   Msgbox("tag " & btnNotes.Tag,"")
End Sub
 

splatt

Active Member
Licensed User
Longtime User
B4X:
btnNotes.Initialize("")

Should be:

B4X:
btnNotes.Initialize("btnNotes")

You can then pick up btnNotes_Click or if you define it, btnNote_LongClick.
 
Upvote 0
Top