Sub Globals
'These global variables will be redeclared each time the activity is created.
Dim panelarray(4) As Panel
Dim selected(4) As Boolean
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim i As Int
Dim xpos As Float = 0.0
Dim pwidth As Float = 18%x
For i = 0 To 3
panelarray(i).Initialize("sharedevent")
panelarray(i).Tag = i
Activity.AddView(panelarray(i), xpos, 0%y, pwidth, 10%y)
xpos = xpos + 20%x
panelarray(i).Color = Colors.Yellow
Next
End Sub
Sub sharedevent_Click
Dim p As Panel = Sender
Log(p.Tag & " was clicked")
selected(p.Tag) = True
End Sub
Sub sharedevent_LongClick
Dim p As Panel = Sender
Log(p.Tag & " was long-clicked")
If selected(p.Tag) Then
Log("we can drag the selected panels")
Dim sb As StringBuilder
sb.Initialize
Dim i As Int
For i = 0 To selected.Length - 1
If selected(i) Then
sb.Append( i ).Append(" ")
End If
Next
sb.Append(CRLF)
Log("i would be dragging panels: " & sb.ToString)
Else
Log("panel " & p.Tag & " was not previously selected. so no drag at this time. maybe later")
End If
End Sub