Image Control/LaunchCam

Karl Arthur

New Member
Hi, could you tell me if it’s possible to display an image that has just been taken via LaunchCam in an Image control please? I have tried setting the source on an Image control to an image field but it doesn’t display – you can only view it by tapping the button control and bringing up the camera dialogue box. This is on an Android device.

Also, is it possible to test if an image has actually been taken (rather than just using the OnClick event in the form logic list), so that I can change a button colour? I’ve tried testing if the control is >= null (blank field) but it doesn’t work. If someone clicks a button and just cancels that won’t tell me if the photo has been taken.

Many thanks

Karl
 

Fahim Ali

New Member
Karl,

Unfortunately, it's not possible to view the picture you've taken for the current record until the record is saved/submitted, and you reopen the record for editing from the data view (or retrieve it via a previous record/next record button action).

However, it is possible to set the color of your specified control to indicate that the image exists, although the setup is a little tricky. First, you will need the control ID of your actual image field. You will notice that the image field on your entry form is actually a button, with a source field pointing to your actual image field. It is not possible to directly place the image field as an actual field on the form; every time you do so, you will receive a button. This is an intentional design choice. The image field itself is hidden on the form.

Since you are using an Android device, we will need to open up the skins file that corresponds to that platform for the session in which your image field exists. First, navigate to the root TracerPlus Desktop Projects directory for your machine. It is usually in the user's Documents directory, like the below:

C:\Users\<username>\Documents\TracerPlus Desktop\Projects
In this directory, find the project you are working on. Then, navigate through the following directories: ProjectFiles > SystemInfo > Skins

In the Skins directory, you will see a number of files; the ones marked with a .tac extension are the ones we are interested in. If you cannot easily find the file extension next to the file name, look for the Type column; if that does not exist, add it by right clicking on the Name column header, and selecting the Type column.

These .tac files are your session files, and marked with the same number as your sessions in your TracerPlus Desktop Project. Unfortunately there is no easy way to determine the session number, other than counting it from the list. Once you've determined the right session, open that corresponding Sxx_entryskin.tac file, where 'xx' is the two digit session number starting from '01', in a text editor (Notepad will work fine). Then, use a find operation (CTRL + F) to locate the image field in this file. You can search based on field name. You're looking for the field name to appear next to this text:
data-displayname.

When you find it, you'll see this information is encapsulated within an input node/element. Within the same node, look for the id attribute. You'll see it is marked something like this: 00-18. The 00 in this case marks the session number, and the 18 marks the field index. This is in my project, yours will look different, but the idea is the same: you want the number after the dash.

Now that we finally have our hidden field's actual ID, we can set up our logic item.

Set up the logic item like so:
  • Event: AfterScan
  • Event Control: (the ID you just retrieved)
  • If/Conditions:
    • Condition Control: (the ID you just retrieved)
    • Comparison Type: Contains
    • Value: BLOB
  • Action: SetBackColor
  • Action Controls: choose the control(s) on the form, by their ID, that you want to change the color of (separated by comma)
  • Action Value: set a color of your choice
  • Perform Else: enable this
  • Else Value: the color to display on your control(s) if the condition is not met
When an image is now taken, it will set your specified controls to the color specified in Action Value, and if the image is cleared, it will set it to the color specified in Else Value. This only works after the image window has been opened at least once, so you may want to set the initial color of your specified controls to the Else Value color until the image is taken. Hope this helped.
 

Karl Arthur

New Member
Hi Fahim,

Thanks very much for your reply. I have followed your instructions on how to check if an image exists but cannot get it to work. The button doesn't change colour after taking the photo and closing the camera dialog box.

In the .tac file I have the following code for the field Photo1:

<div style="position: absolute; background-color:#FFFFFF; top:0px; left: 0px; width:-2px; height:17px;" >
<input name="Field18" id="00-107" type="hidden" style="color:#000000;background-color:#FFFFFF;font-family:Tahoma;font-size:11px;font-weight:normal;height:15px;width: -2px;border-style:solid;border-width:1px;" onKeyDown="return afterScanClicked(event)" OnBlur="javascript:eek:nLostFocus('00-107')" OnFocus="javascript:eek:nFieldFocus('00-107')" data-displayname="Photo1" data-fieldindex="17" data-fieldtype="Image" data-datatype="General" data-gotofield="17" data-valid-goto="17" data-valid-soundfile="" data-includeinexport="1" data-inputtype="Any" />
</div>

In the form logic I have added the entry:
AfterScan 107 If ControlID 107 Contains BLOB SetBackColor 83 (a button) to green

This is the code for the button itself:

<div style="position: absolute; background-color:#F0F0F0; top:30px; left: 29px; width:154px; height:24px;" >
<input id="00-83" class="EntryFormButton" type="button" style="color:#000000;background-color:#FFFFFF;font-family:Tahoma;font-size:13px;font-weight:normal;height: 26px; width: 156px;border-style:solid;border-width:1px;border-radius:5px;text-shadow: 0 1px 1px rgba(0,0,0,.3);" value="Take Picture" onClick="javascript:handleFormButtonClicked('00-83','9');" data-actiontype="9" data-gotoctrlindex="00--1" data-sourcefield="17"/>
</div>

Is there anything else that I could try please?

Many thanks

Karl
 

Fahim Ali

New Member
Karl,

Please acquire a TracerPlus Desktop export file of your project. To do this, open your project in TracerPlus Desktop and then choose File > Export in the top menu bar. You will get a resulting .tpe file placed where you specified.

Please attach this file in an email addressed to support@tracerplus.com. This will open a support ticket in our ticket system which the support team can review to best help resolve your issue.

Please DO NOT attach your .tpe file to this thread, as that will be ignored. (and you wouldn't want your project to be available publicly anyway)

Thank you.
 

Corey Hagewood

Moderator
Staff member
Hi Karl,

I have received your project and with making a few changes got things working.

Can you check the skins file again? I saw field 18 as id 109 when I had deployed the project to my device. After I saw that simply switch the references from 107 in the logic item to 109 in the logic item, things started working correctly.

Let me know if you have any questions on this.
 

Karl Arthur

New Member
Hi Corey,

Thanks for your help. I'm not sure why the id changed from 107 to 109.

That works to a certain extent - when you tap Done on the camera dialog box the button changes colour. If you don't actually take a photo though the button still changes colour.

This is the form logic event:
AfterScan 109 If ControlID 109 Contains BLOB SetBackColor 83 (a button) to green

I also have a form logic event that changes the button to white before hand to make sure it's white unless the BLOB exists:
OnClick 83 SetBackColor 83 to white

Many thanks

Karl
 

Corey Hagewood

Moderator
Staff member
Hi Karl,

I am unclear, was that your solution to the button turning Green even when just hitting the done button?

Or is that still happening, and this new Onclick event is something you tried to use to fix it, but it is still not working?
 

Karl Arthur

New Member
Hi Corey,

I added the new OnClick event to try to fix it but it still doesn't work.

When using the following form logic event I assume that 'BLOB' won't exist if you just click Done in the camera dialog box (without taking a photo), so the button should then change to white via the Else event. I added the OnClick event to make sure that the button is white if it doesn't go through the Else event for some reason.

AfterScan 109 If ControlID 109 Contains BLOB SetBackColor 83 (a button) to green Else white

Regards,

Karl
 

Fahim Ali

New Member
Karl,

I would suggest you remove your secondary OnClick logic item, as it is adding complication where it is not needed. The Else branch will always be executed if the If condition fails, that is how the branching works. If you want to ensure the button is white or whatever color you need to set it as before the picture is taken, I would suggest you set that at the form designer level.
 

Karl Arthur

New Member
Hi Fahim,

I removed the OnClick logic item and still get the same problem, the button turns green even if you don't actually take a photo (just go into the camera dialog box and out again). It's as if it isn't going through the Else event or BLOB isn't being cleared if you don't take a photo.

To prove that none of the other events are causing the issue I created a new project with a simple form and the problem occurs there too. I can email this project file if you would like me to.

Regards,

Karl
 
Top