'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Type tabStop(nextStop As Int)
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout ("txtBoxes")
loadTxtBoxes
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub loadTxtBoxes
For k=0 To 9
Dim a As Int
a=Rnd(0,3)
If a>0 Then
Dim txtB As EditText
txtB.Initialize ("txtBox")
Dim en As Boolean
If Rnd(0,2)=0 Then en=True Else en=False
txtB.Enabled =en
txtB.SingleLine =True
Activity.Addview (txtB,0,Activity.Height/10*k,Activity.Width /2,Activity.Height/10-5dip)
Else
Dim lmb As Label
lmb.Initialize ("")
lmb.Text="just a label"
Activity.Addview (lmb,0,Activity.Height/10*k,Activity.Width /2,Activity.Height/10-5dip)
End If
Next
For k=0 To Activity.NumberOfViews -1
Dim loopPoint As Int
Try
Dim temptextBox As EditText
Dim nextFound As Boolean
nextFound=False
temptextBox=Activity.GetView (k)
Dim tempTab As tabStop
tempTab.Initialize
For l=0 To Activity.NumberOfViews -2
loopPoint=(k+l+1) Mod Activity.NumberOfViews
If nextFound=False Then
Try
Dim temp2 As EditText
temp2=Activity.GetView (loopPoint)
tempTab.nextStop =loopPoint
nextFound=True
Catch
'not a text box
End Try
End If
Next
If nextFound=False Then tempTab.nextStop =k
temptextBox.Tag =tempTab
Catch
' not a text box
End Try
Next
End Sub
Sub txtBox_FocusChanged(HasFocus As Boolean )
Dim tb As EditText
tb=Sender
If HasFocus=True AND tb.Enabled =False Then
Dim tempTab As tabStop
tempTab.Initialize
tempTab=tb.Tag
Activity.GetView (tempTab.nextStop).RequestFocus
End If
End Sub