Code: Select all
PROC GLOBAL
string photoDir, //Stores the location of the photos folder
photoFileName //filename of photo
;
//Function to take a photo using the device's camera. It saves to a filename matching the ID items
function takePhoto()
if direxist(photoDir) then
execsystem(maketext("camera:%s",photoFileName));
else
dircreate(photoDir);
execsystem(maketext("camera:%s",photoFileName));
endif;
end;
//Function to view photo of current case
function viewPhoto()
if direxist(photoDir) then
execsystem(maketext("view:%s", photoFileName));
else
dircreate(photoDir);
execsystem(maketext("view:%s", photoFileName));
endif;
end;
PROC LABOURFORCE_FF
preproc
photoFileName = pathname(CSEntry) + maketext("Menu/Photos/%03d-%03d-%d-%03d.jpg", visualvalue(RNDNO),visualvalue(EDNO),visualvalue(STRATUM),visualvalue(HHNO)); //DEBUG: Not saving file with Rndno, edno, and stratum
photoDir = pathname(CSEntry) + "Menu/Photos";
userbar(clear);
userbar(add button, "Get Location", getgps()); //adds a "Get location" button to get coordinates
userbar(add button, "Take a photo for the current case", takePhoto()); //adds a button to take a photo of current case.
userbar(add button, "View photo of current case", viewPhoto()); //adds a button to view photo of current case
userbar(show);