Sub Process_Globals
Private xui As XUI
End Sub
Sub Globals
Dim pnlBoard As Panel ' Panel that hosts the score labels
Dim labels As List ' List of labels showing scores
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
labels.Initialize ' Build labels ito a list
For Each lbl As Label In pnlBoard.GetAllViewsRecursive
labels.Add(lbl)
Next
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub label_Click
Dim target As Label = Sender ' The new leader
Dim pitch As Int = target.Height ' Offset between labels
Dim oldTop As Int = target.top ' Old offset of new leader
Dim newtop As Int ' New top for each label
For Each lbl As Label In labels ' Update all changing label positions
newtop = lbl.Top ' Actually "old top" at this point
If (lbl.Top < oldTop) Then newtop = lbl.Top + pitch
If (lbl.Top = oldTop) Then
newtop = 0 ' This is the new leader
lbl.BringToFront ' Improves visual appeal
End If
If (lbl.Top <> newtop) Then lbl.SetLayoutAnimated(1000, lbl.Left, newtop, lbl.Width, lbl.Height)
Next
End Sub