sender return the wrong object

capisx

Member
Licensed User
Longtime User
why the sender can return the wrong object?
it happen when the code run through multiple "for" loop, the code run like i have expected but after that the sender return the wrong object for some imageview that i've click and some return the right object.
in my app i have 84 imageview (array).
this problem make me headache... :BangHead:
 

JonPM

Well-Known Member
Licensed User
Longtime User
It's better to post your code so we can help you

Sent from my DROIDX
 
Upvote 0

capisx

Member
Licensed User
Longtime User
:signOops: i have make a mistake in my code, sorry to bother you guys

this is the problem maker:
B4X:
Sub Tile_Click
   Dim b As ImageView
   b=Sender
   If TileA<>"" Then
      TileB=b.Tag
      ValueInitB
      If am<>bm Then
         TileB=""
         ClrSel
      End If
   End If
   If FirstTile=True Then
      sounds.Play(sel1,1,1,1,0,1)
      ta=Sender 'Should be ta=b
      tile1.SetLayout(ta.Left,ta.Top,ta.Width,ta.Height)
      tile1.Visible=True
      tile1.BringToFront
      ani2.Start(tile1)
      TileA=b.Tag
      FirstTile=False
      ValueInitA
   Else If SecondTile=True Then
      sounds.Play(sel2,1,1,1,0,1)
      tb=Sender 'Should be tb=b
      SecondTile=False
      tile2.SetLayout(tb.Left,tb.Top,tb.Width,tb.Height)
      tile2.Visible=True
      tile2.BringToFront
      ani3.Start(tile2)
      MatchCheck
      If match=True Then 
         DrawLink
         ClrTile
         skorlbl.Text="Score" & CRLF & NumberFormat(skor,0,0)
      End If
   End If
End Sub

Thanks JonPM, you somehow make my eyes open
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…