Pendragon Software Corporation
Home News Products Order Support Company

Case Studies

 

 

 

Making a form for data & photo collection:

A step-by-step guide to using custom controls for Zire and Clie cameras

Creating a form for photo data collection

If you are not familiar with building and distributing a Pendragon Form, you may wish to review the Quick Start Guide for an overview.

 

On your form, you will need to include:

• A Custom Control field

• A script in the Custom Control field that attaches the new photo to an Image field in your form

• An Image field to store photos 

 

The Custom Control Field

To add the Camera Control to your form, create a new field on your form and select the Custom Control field type.  In the Component Name box, select Zire JPEG Camera or SONY Camera, depending on your handheld.

 

Camera Custom Control Parameters

 

Zire 72 Custom Control Parameters

The Camera Control has four adjustable parameters that apply only to the Zire 72: CameraKey, ShutterKey, ShutterTurnsOffCamera, and AllowLargeImages.
 

CameraKey

The CameraKey parameter sets the key code that will power the camera on and off. By default, this parameter is zero, and the camera is turned on and off using the Voice Memo button.
 

ShutterKey
The ShutterKey parameter sets the key code that acts as a shutter button. By default, this parameter is zero and the 5-way navigation button is used as the shutter button.

 

The following table contains a list of key codes that might commonly be used for controlling the camera.

 

Key Code

Button

516 through 519

Hardware application buttons one through four

532

Voice Memo button

1280

Clock Silkscreen button

1282

Brightness Silkscreen button

266

Find Silkscreen button

267

Calculator/HotSync (Star) Silkscreen buton

 

ShutterTurnsOffCamera

Normally, pressing the shutter button captures an image, but does not deactivate the camera and viewfinder. The ShutterTurnsOffCamera option can be set to Y to turn off the camera and the viewfinder when the shutter button is pressed.
 

AllowLargeImages
The Zire 72 has a maximum image resolution of 1280x960 pixels. To enable the camera control to capture images at this resolution instead of 640x480, set the AllowLargeImages parameter to Y.

 

 

 

Sony Camera Custom Control Parameters

The Camera Control has four adjustable parameters: CameraKey, ShutterKey, ShutterTurnsOffCamera, and ImageSize.
 

CameraKey

The CameraKey parameter sets the key code that will power the camera on and off. By default, this parameter is 516, and the camera is turned on and off using the first hardware application button (the DateBook button).

 

ShutterKey

The ShutterKey parameter sets the key code that acts as a shutter button. By default, this parameter is zero and the standard camera shutter button is used to capture the exposure.

 

The following table contains a list of key codes that might commonly be used for controlling the camera.
 

Key Code

Button

516 through 519

Hardware application buttons one through four

5888

Jog Up

5889

Jog Down

5893

Jog Push

5894

Jog Release

5895

Jog Back

5896

Jog Left

5897

Jog Right

5900

Camera Capture button

5901

Voice Record button

5927

Camera Cover Open

 


ShutterTurnsOffCamera

Normally, pressing the shutter button captures an image, but does not deactivate the camera and viewfinder. The ShutterTurnsOffCamera option can be set to Y to turn off the camera and the viewfinder when the shutter button is pressed.

ImageSize

The Clie control normally captures images at 640x480 resolution. It is possible to have the camera capture images at 320x240 resolution by setting the ImageSize parameter to 320x240.

 

 

Scripting

A simple script in the Custom Control field renames a picture that was just taken with the camera and attaches it to the database record.  This script is for a form where Field 3 is the Custom Control field and Field 4 is the Image field. 

 

(You can copy and paste one of these scripts into your form design, just make sure to change the field numbers highlighted in red to match the field numbers in your form design.)

 

Sample Scripts

How the Script Works

For FormsZire71jpg.prc or

SonyCamCtrl.prc

 

CLICK:

IMAGEFILENAME 4

TEMP = RESULT & ".JPG"

RESULT = TEMP

CALLMETHOD 3 "SETFILENAME"

$4 = TEMP

 

For FormsZire71.prc

 

CLICK:

IMAGEFILENAME 4

TEMP = RESULT & ".BMP"

RESULT = TEMP

CALLMETHOD 3 "SETFILENAME"

$4 = TEMP

 

The IMAGEFILE statement gets the appropriate filename for the Image field and places it in the RESULT variable.  The filename for a give Image field on a given form is fixed.  However, the extension may change depending  on what is stored in the Image field.  For example, the filename could be "OA123456000023450004".

The next statement assigns TEMP the filename plus the .JPG file extension.  Now TEMP would look like "OA123456000023450004.JPG".

RESULT is assigned the same value as TEMP so that it can be passed on to the SETFILENAME method.

The CALLMETHOD statement calls the control in field 3 (the Camera Control) and asks it to perform the method called "SETFILENAME". The control reads the RESULT variable, and renames the file.  In our example, the file "/FORMS4/PFTEMP.JPG" becomes "/FORMS4/OA123456000023450004.JPG".

Assigning the file name to field 4 (the Image field) completes the attachment.

 

 

 

 

After you have added all other fields to your form, freeze the form, distribute it to your handheld and synchronize the handheld.

 

 

Next:

Taking pictures

Synchronization & data review

Creating an Access report (for bitmap images only)

Creating an Access Report with a Photo Control (for jpeg images)

This page may take a moment to load. 

 

Previous:

Introduction: Using a PDA camera for data collection

 

 

 

 

For more information

Documentation for the Zire71 Camera Custom Control (81KB PDF)

Documentation for the Zire71JPEG Camera Custom Control (83KB PDF)

Documentation for the Sony Camera Custom Control (94KB PDF)

Using JPEG images with Pendragon Forms

PDA cameras, pictures and  Pendragon Forms

Tutorial: Importing Stored Photos (for devices including the Treo 650 and iPAQ rx3715)

Pendragon Forms Reference Guide, Chapter 17: Working with Images  (6.6MB PDF)

 

(To download PDF documents, right-click on the link above and choose Save Target As...)

 

 

 

 

 

© 2004 Pendragon Software Corporation.  All rights reserved. Copyright and trademark information.