Hi,
I have several buttons in a photo and I need to maake the clicked button blinking. I now how to do that, but for that I need the button as an object.
I hope the code speaks for itself.
Thanks
I have several buttons in a photo and I need to maake the clicked button blinking. I now how to do that, but for that I need the button as an object.
I hope the code speaks for itself.
Thanks
B4X:
Sub Globals
dim pointlist as list
end sub
Sub Activity_Create(FirstTime As Boolean)
pointlist.initialize
end sub
...
' add the button to a map and the map to a list
Dim m As Map
m.Initialize
m.Put("no",no)
m.Put("x",x)
m.Put("y",y)
m.Put ("btn",b) ' b is a button
If pointlist.IndexOf (m) = -1 Then
pointlist.Add (m)
End If
Sub touchbtn_click
Dim Send As Button
Send=Sender
clickedno=Send.tag
clickedbtn=Sender
msgbox (clickedbtn.Left, clickedbtn.Top) ' here I get a null pointer exception
' search for the button in the list
Dim m As Map
Dim i As Int
For i=0 To pointlist.Size-1
m=pointlist.get (i)
Dim no As Int
no=m.Get ("no")
' Msgbox (no,clickedno)
If no=clickedno Then
clickedbtn=m.Get ("btn")
msgbox (clickedbtn.Left, clickedbtn.Top) ' here I get a null pointer exception
End If
Next
' this is what I want to do
Sub timer2_tick
clickedbtn.SetColorAnimated (1000,Main.ptealcolor,Colors.red) ' won't work
Last edited: