Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim c As Canvas
Dim rl As Rect
Dim rr As Rect
Dim l As Int: l = 5dip
Dim SeekBar1 As SeekBar
Dim oldValue As Int
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
SeekBar1.Initialize("Seekbar1")
Activity.AddView(SeekBar1, 0, 0, 200dip, 50dip)
c.Initialize(Activity)
oldValue = Activity.Height/2
c.DrawCircle(Activity.Width/3,Activity.Height/2,5dip,Colors.Green,True,1dip)
c.DrawCircle((2*Activity.Width/3),Activity.Height/2,5dip,Colors.Red,True,1dip)
End Sub
Sub Activity_Resume
End Sub
Sub SeekBar1_ValueChanged (Value As Int, UserChanged As Boolean)
Dim h As Int
h = (Activity.Height*(Value+120))/240
If oldValue > 0 Then
c.DrawCircle(Activity.Width/3,oldValue,5dip,Colors.Transparent,True,0) 'Doesn't work
c.DrawCircle((2*Activity.Width/3),oldValue,5dip,Colors.Transparent,True,0) 'Doesn't work
End If
'c.DrawCircle(Activity.Width/3,h,5dip,Colors.Black,True,0) 'Doesn't work
'c.DrawCircle((2*Activity.Width/3),h,5dip,Colors.Black,True,0) 'Doesn't work
'c.DrawColor(Colors.Black) 'Works
c.DrawCircle(Activity.Width/3,h,5dip,Colors.Green,True,0)
c.DrawCircle((2*Activity.Width/3),h,5dip,Colors.Red,True,0)
oldValue = h
Activity.Invalidate
End Sub