'Class module
Sub Class_Globals
Public asView As Button
Private myClearWindow As Label
Private originalX, originalY As Int
Private holdingView As Panel
Private Gesture As Gestures
Private listAllTrickButtons As List
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(ViewHoldingButton As Panel, listButtons As List)
asView.Initialize("myButton")
myClearWindow.Initialize("myClearWindow")
holdingView = ViewHoldingButton
listButtons.Add(Me)
'------------- I first got the error here, so thought I would wait til all buttons instantiated
'listAllTrickButtons = listButtons
Gesture.SetOnTouchListener(myClearWindow, "Gestures_Touch")
End Sub
Public Sub StartMe
holdingView.AddView(myClearWindow, asView.Left, asView.Top, asView.Width, asView.Height)
holdingView.Color = Colors.Transparent
End Sub
'---------------- this is the error code
Public Sub setTrackerList(listButtons As List)
listAllTrickButtons = listButtons
End Sub
Sub Gestures_Touch(View As Object, PointerID As Int, Action As Int, X As Float, Y As Float) As Boolean
If Action = Gesture.ACTION_DOWN Then
originalX = asView.Left
originalY = asView.Top
Return True
End If
If Action = Gesture.ACTION_MOVE Then
Log(PointerID)
asView.Left = X + originalX - asView.Width/2
asView.Top = Y + originalY - asView.Height - 20dip
Return True
End If
If Action = Gesture.ACTION_UP Then
asView.Left = originalX
asView.Top = originalY
End If
End Sub