Exercise 1: Signature Capture
Signing a feature record may be desirable when a field worker needs to be held accountable for the field work completed, or when someone else needs to verify the work, for example a supervisor. The signature is captured directly on the form and stored as a hyperlinked image similarly to the photos in the previous exercise. This exercise also uses the same two samples from the previous exercise. If you have not already downloaded these, they are available for download on ArcGIS Online.
ArcPad sample for Windows Mobile devices: http://www.arcgis.com/home/item.html?id=388f1dfe0ac24fcd8f858958a7cb7fad
ArcPad sample for Tablets/PC: http://www.arcgis.com/home/item.html?id=40d995dbb74442eb9f7eb6af0e06ec12
Calling the Sketch extension in your edit form, for signature capture
In the sample project, the sketch extension is called from the onclick event of the IMAGEBOX control on the Signature page of the poles edit form.
In ArcPad Studio, open the Poles edit form of the WorkArea_C.axf.
- On the Signature tab of the form, double click the IMAGEBOX to view the controls properties.
- The two important properties on this dialog are Field and Click Action. Field must be assigned to a text field (in this case SIGNATUREHYPERLINK) and the Click Action must be set to None.
- On the onclick event, the function EditPhoto (shown below) is called.
Using signature capture in ArcPad
The steps to capture a signature in ArcPad (using this customized form) are
- Select the existing feature in ArcPad, and open the feature properties dialog.
- On the Signature tab of the feature properties dialog, tap on the box to launch the sketch extension. You will see the color and width choosers, OK and Cancel buttons, appear.
- Sign your name and tap the sketch ok button. Then tap OK to commit the feature attribute change (in this case the new image file name) to the AXF.
The EditSignature function differs from the EditPhoto function by discarding and deleteing previous sketches whereas the EditPhoto function keeps them. The EditSignature functions sketch is docked into the IMAGEBOX control by using it windows handle (whereas the EditPhoto functions sketch is undocked).
EditSketch function used to call the Sketch extension for signature capture.
Sub EditSignature
Dim file
Set file = Application.CreateAppObject("FILE")
Dim imgSignature
Set imgSignature = ThisEvent.Object
Dim editLayer
Set editLayer = Map.EditLayer(1)
Dim extSketch
Set extSketch = Extensions("@SKT")
If extSketch is Nothing Then
MsgBox "ArcPad Sketch extension not installed"
Exit Sub
End If
Dim folder, pos, nextpos
folder = editLayer.FilePath
pos = InStr(folder, "\")
If pos > 0 Then
nextpos = InStr(pos + 1, folder, "\")
While nextpos > 0
pos = nextpos
nextpos = InStr(pos + 1, folder, "\")
Wend
folder = Left(folder, pos - 1)
End If
Dim filename, path, ymd, hms, prefix
ymd = Year(Now) * 10000 + Month(Now) * 100 + Day(Now)
hms = Hour(Now) * 10000 + Minute(Now) * 100 + Second(Now)
prefix = imgSignature.Field.Name + "_"
filename = prefix & ymd & "_" & Right(1000000 + hms, 6) & ".jpg"
path = folder + "\" + filename
If extSketch.Escape(path, 75, imgSignature.hWnd) Then
If imgSignature.Value <> "" Then
If file.Exists(folder + "\" + imgSignature.Value) Then
Call file.Delete(folder + "\" + imgSignature.Value)
End If
End If
imgSignature.Value = filename
imgSignature.Field.Value = filename
End If
End Sub