Page 1 of 1

aXes Mobile - How to add a button to Copy to Clipboard

Posted: 08 Aug 2014, 16:35
by jeanmichel
How to add a button to a project to use the mobile device's Copy to Clipboard feature

1) Open aXes development environment

Image

2) Load your project in TS2 and navigate to the screen you wish to customise

Click on "Work as a TS2 Developer"

Image

Signon to your session

Image

Type on the command line: "addlible axesdemo" followed by enter

Image

Type on the command line: "call xhrrpgtrn" followed by enter

Image

Put an X next to to an employee

Image

If you don't have a screen definition, press suggest and save the screen.

Image

3) Add a PushButton

Image

4) Edit caption. Change the caption value to "Copy address to clipboard"

Image

5) Click on the "Screens" tab

Please note: This script uses the values of the fields Title, Street, City, State, Country, ZIP, PhoneNB and these names need to be defined in the screens tab of TS2 development environment for the relevant fields.

Change Fields Names to Title, LastName, FirstName, Street, City, State, Country, ZIP, PhoneNB.

Image

6) Edit script

Image

Copy and paste the script hereunder in the edit box.

Code: Select all

if (window.LRSV)
{
var clipText = FIELDS("Title").getValue() + " " + FIELDS("LastName").getValue() + " " + FIELDS("FirstName").getValue() + "\r\n";
var clipText1 = FIELDS("Street").getValue()+ "\r\n";
var clipText2 = FIELDS("City").getValue()+ ", ";
var clipText3 = FIELDS("State").getValue()+ ", ";
var clipText4 = FIELDS("Zip").getValue()+ "\r\n";
var clipText5 = FIELDS("Country").getValue()+ "\r\n";
var clipText6 = FIELDS("PhoneNB").getValue()+ "\r\n";

var items = [ { text : clipText}, { text : clipText1}, { text : clipText2}, { text : clipText3}, { text : clipText4}, { text : clipText5}, { text : clipText6} ];
var options = { arrayItems:items } ;
try { LRSV.copyToClipboard( options ); }
catch (Error) { alert("problem in clipboard " + Error.message ); }
}
7) You should now have a button on your screen which looks like this:

Image

8) open aXes mobile and run your demonstration

Image Image Image