Sub Globals
Dim pnlPlay As Panel
Dim StartX, StartY As Int
Dim FinishX, FinishY As Int
Dim pnlPlayLeft, pnlPlayTop As Int
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim pnlHeight, pnlWidth As Int
Dim LabelLeft, LabelTop, LabelWidth, LabelHeight, LabelXDelta, LabelYDelta As Int
pnlPlay.Initialize("pnlPlay")
pnlPlay.Color = Colors.green
LabelLeft = 5dip
LabelTop = 5dip
LabelWidth = 100dip
LabelXDelta = LabelWidth + 5dip
LabelHeight = 70dip
LabelYDelta = LabelHeight + 5dip
Activity.AddView(pnlPlay, 0, 0, 100%x, 100%x)
For i = 0 To 19
Dim lblPlay As Label
lblPlay.Initialize("cell")
lblPlay.Color = Colors.Blue
lblPlay.Text = "Value " & i
lblPlay.Tag = i
pnlPlay.AddView(lblPlay, LabelLeft + (i Mod 4) * LabelXDelta, LabelTop + Floor(i/4) * LabelYDelta, LabelWidth, LabelHeight)
Next
End Sub
Sub Activity_Touch (Action As Int, X As Float, Y As Float)
Select Action
Case Activity.ACTION_DOWN
StartX = X
StartY = Y
pnlPlayLeft = pnlPlay.Left
pnlPlayTop = pnlPlay.Top
Case Activity.ACTION_MOVE
FinishX = X
FinishY = Y
pnlPlay.Left = pnlPlayLeft + (FinishX - StartX)
pnlPlay.Top = pnlPlayTop + (FinishY - StartY)
End Select
End Sub