#Event: Response(Response as int, Signature as bitmap)
#RaisesSynchronousEvents: BMsgBox3_Click
Sub Class_Globals
Public Response As Int = 100
Public Sign As Bitmap
Public ColoreStyle As Int = Colors.RGB(121,179,228)
Private IsInitialized As Boolean = False
Private My As Activity
Private Pan As Panel
Private Box As Panel
Private CallBack As Object
Private Event As String
Private PanelFirma As Panel
Private Firma As Canvas
Private Image As ImageView
Private px,py As Int
End Sub
Public Sub Initialize(MyActivity As Activity, Me_CallBack As Object,EventName As String)
My=MyActivity
CallBack=Me_CallBack
Event=EventName
IsInitialized=True
Sign=Null
End Sub
private Sub PanelMsgBox3_Touch (Action As Int, X As Float, Y As Float)
Dim P As Phone
P.HideKeyboard(My)
End Sub
#Region Box
'-100 Error not initialized
Sub Show(Title As String, Positive As String, Negative As String)
Dim Larghezza As Int = 300dip
Dim LBu3 As Int = (Larghezza-40dip)/3
If IsInitialized Then
Pan.Initialize("PanelMsgBox3")
Pan.Color=Colors.ARGB(210,10,10,10)
My.AddView(Pan,0dip,0dip,100%x,100%y)
Box.Initialize("Box")
Box.Tag=""
'Box.Color=Colors.White
' Box.Background=Corner(Colors.White)
Pan.AddView(Box,50%x-Larghezza/2,50%y-150dip,Larghezza,300dip)
Dim L As Label
L.Initialize("")
' L.SetBackgroundImage(Underline(Colors.White,Colors.DarkGray,True))
L.Textcolor=Colors.Black
L.Gravity=Gravity.CENTER
L.TextSize=18
L.Typeface=Typeface.DEFAULT_BOLD
L.Text=Title
Box.AddView(L,20dip,0dip,Larghezza-40dip,50dip)
PanelFirma.Initialize("PanelFirma")
Box.AddView(PanelFirma,20dip,50dip,Larghezza-40dip,180dip)
Firma.Initialize(PanelFirma)
Firma.DrawColor(Colors.White)
' Dim obj As Reflector
' obj.Target = PanelFirma
' obj.SetOnTouchListener("PanelFirma_Touch")
Dim ResPanel As Panel
ResPanel.Initialize("")
' ResPanel.SetBackgroundImage(Underline(Colors.White,Colors.DarkGray,False))
Box.AddView(ResPanel,20dip,240dip,Larghezza-40dip,60dip)
Dim BPositive, BCancel, BNegative As Button
If Positive.Trim<>"" Then
BPositive.Initialize("BMsgBox3")
BPositive.Text=Positive
BPositive.Gravity=Gravity.CENTER
BPositive.TextColor=Colors.Black
BPositive.Typeface=Typeface.DEFAULT_BOLD
'BPositive.Background=Corner(ColoreStyle)
BPositive.Color=Colors.Transparent
BPositive.Tag=DialogResponse.POSITIVE
Box.AddView(BPositive,10dip,240dip,LBu3,60dip)
End If
If Negative.Trim<>"" Then
BNegative.Initialize("BMsgBox3")
BNegative.Text=Negative
BNegative.Gravity=Gravity.CENTER
BNegative.TextColor=Colors.Black
BNegative.Typeface=Typeface.DEFAULT_BOLD
'BNegative.Background=Corner(ColoreStyle)
BNegative.Color=Colors.Transparent
BNegative.Tag=DialogResponse.NEGATIVE
Box.AddView(BNegative,Larghezza-LBu3-10dip,240dip,LBu3,60dip)
End If
BCancel.Initialize("BMsgBox3")
BCancel.Text="RESET"
BCancel.Gravity=Gravity.CENTER
BCancel.TextColor=Colors.Black
BCancel.Typeface=Typeface.DEFAULT_BOLD
'BCancel.Background=Corner(ColoreStyle)
BCancel.Color=Colors.Transparent
BCancel.Tag=DialogResponse.CANCEL
Box.AddView(BCancel,20dip+LBu3,240dip,LBu3,60dip)
' Image.Initialize("")
' Image.RemoveView
' Image.TextColor=Colors.Black
' Image.Gravity=Gravity.CENTER
' Image.TextSize=16
' Box.AddView(Image,Box.Width-45dip,5dip,40dip,40dip)
Else
ToastMessageShow("MessageBox not initialized",False)
End If
End Sub
'Private Sub PanelFirma_Touch (viewtag As Object, action As Int, X As Float, Y As Float, motionevent As Object) As Boolean
Private Sub PanelFirma_Touch (Action As Int, X As Float, Y As Float)
Log("Touch")
If Action = 0 Then 'mouse down constant
px = x
py = y
Else
Firma.DrawLine(px, py, x, y, Colors.Black, 3dip)
PanelFirma.Invalidate
px = x
py = y
End If
Return True
End Sub
#End Region