Button dynamic

JATAIDE

Member
Licensed User
Longtime User
This may be a simple matter for you but I have been trying and I can not do the following:
I created a ScrollView in which also created buttons dynamically. So far all is well.
However when I create a function to the button, eg

sub r1_Click

r1.text = "X"
'or
msxbox ("xxxx", "ok")

end Sub

When I click the button ScrollView no effect.

If it is a button created in the designer gives the message correctly.

thank you
 

NJDude

Expert
Licensed User
Longtime User
If you have crated the button manually you must add the EVENT name:
B4X:
Dim r1 As Button

...

r1.Initialize("") '<--No event name, therefore the click won't trigger

r1.Initialize("r1") '<-- This will do what you need


...

Sub r1_Click

    MsgBox ("xxxx", "ok")

End Sub
 
Upvote 0

JATAIDE

Member
Licensed User
Longtime User
button

Ok thanks, I had actually done so:
r1.Initialize (r1)
and it was well before

r1.Initialize ("r1")

thank you
 
Upvote 0
Top