Sub Process_Globals 'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
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.
Dim TransparentPanelOnTop As Panel
Dim Button1 As Button
Dim Button2 As Button
Dim Label1 As Label
Dim PositionX As Float
Dim PositionY As Float
End Sub
Sub Activity_Create(FirstTime As Boolean)
Label1.Initialize("Label1")
Button1.Initialize("Button1")
Button2.Initialize("Button2")
TransparentPanelOnTop.Initialize("") 'remove the event name parameter
Label1.Text = "Waiting for click..."
Button1.Text = "I am a Button1 CLICK ME"
Button2.Text = "I am a Button2 CLICK ME"
Activity.AddView(Label1,10,10,Activity.Width - 20,60)
Activity.AddView(Button1,10,100,Activity.Width - 20,60)
Activity.AddView(Button2,10,180,Activity.Width - 20,60)
Activity.AddView(TransparentPanelOnTop,0,0,100%x,1 00%y)
TransparentPanelOnTop.Color = Colors.Transparent
TransparentPanelOnTop.BringToFront
Dim r As Reflector
r.Target = TransparentPanelOnTop
r.SetOnTouchListener( "TransparentPanelOnTop_Touch")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub TransparentPanelOnTop_Touch (viewtag As Object, Action As Int, x As Float, Y As Float, motionevent As Object) As Boolean 'Return True to consume the event
If Action = Activity.ACTION_DOWN Then
PositionX = x
PositionY = Y
Return False
End If
End Sub
Sub Button1_Click
Label1.Text = "You Clicked Button1 with positions : X = " & PositionX & " Y = " & PositionY
End Sub
Sub Button2_Click
Label1.Text = "You Clicked Button2 with positions : X = " & PositionX & " Y = " & PositionY
End Sub