Hi guys,
I basically copy and pasted code out this tutorial into my project, renamed SignatureCapture to WaveFormCapture and did a few other renames.
I'm getting a error "object reference not set to instance of object" for the following line:
WD.Canvas = Canvas1
and
I'm probably missing something really simple but can't see it.
I basically copy and pasted code out this tutorial into my project, renamed SignatureCapture to WaveFormCapture and did a few other renames.
I'm getting a error "object reference not set to instance of object" for the following line:
WD.Canvas = Canvas1
B4X:
Sub Globals
Private btnStart As Button
Dim Timer2 As Timer
Dim Canvas1 As Canvas
Dim Waveform As Panel
Dim WD As WaveFormData
Private GraphView As ImageView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("2")
Canvas1.Initialize(Waveform)
WD.Initialize
WD.Canvas = Canvas1
WD.Panel = Waveform
WD.SignatureColor = Colors.Black
WD.SignatureWidth = 2dip 'Stroke width
Timer2.Initialize("Timer2", 200)
Timer2.Enabled = True
End Sub
B4X:
'Code module
Sub Process_Globals
Dim px, py As Int
Type WaveFormData (Canvas As Canvas, Panel As Panel, WaveFormColor As Int, WaveFormWidth As Int)
End Sub
Sub Panel_Touch(WD As WaveFormData, x As Int,y As Int, Action As Int)
If Action = 0 Then 'mouse down constant
px = x
py = y
Else
WD.Canvas.DrawLine(px, py, x, y, WD.WaveFormColor, WD.WaveFormWidth)
WD.Panel.Invalidate
px = x
py = y
End If
End Sub