Application Templates (ATs) are
.tpa files that define the platform on which a TouchGFX application runs. This approach is for developers who wish to be able to distribute easy-to-use ATs separately from the UI code that runs on top of them. This article describes how an existing TouchGFX project can be packaged into a redistributable AT using the built-in tool
tgfx.exe. For the duration of this article examples are based on an application called "MyApplication".
Once you have a fully functional TouchGFX project the following steps are required to create an AT.
- Describe Application Template Call
tgfx.exeand edit json file (inherits from .touchgfx)
- Create Application Template Call
- Test & Verify Import into designer, create- and verify application
tgfx.exe tool generates a configuration file (.json) that describes the internals of the AT. This information is read by TouchGFX Designer and presented to the user. Open a TouchGFX Environment console and execute the following command in the parent directory of the application:
The following files are created in the directory where the command was run:
Before creating the final
.tpa file, edit
MyApplication.json to control how the AT is displayed to users in TouchGFX Designer. Users should edit the following sections:
- Author Use the fields in the Author section to specify name of author, contact email and a URL.
- Data Use the fields in the Data section to specify AT version, images, board name, vendor, description, and link to further information.
Execute the following command to create the final ´.tpa´ file and finalize the Application Template.
To verify that the
.tpa file can be seen by TouchGFX Designer as an AT and used to create new applications, perform the following steps:
- Rename the
.tpafile to your requirements.
- Copy or move the
C:\TouchGFX\4.13.0\app\packages. This allows users to import ATs into TouchGFX Designer from a local folder.
- Open the Designer and select the AT.
The following section contains tips about what to consider when developing code for/distributing ATs.
Generally, before distributing the
.tpa one should:
- Ensure that all supplied IDE projects work as expected.
- Delete build- and generated folders to reduce the size of the AT.
- Ensure that custom commands (PostGenerate-, etc.) defined in the TouchGFX project file
.touchgfxwork as expected.
- Ensure that the AT can be read by TouchGFX Designer and used to create a new application.
- There is no immediate way to specify an upgrade procedure between versions of ATs.
After distributing the
.tpa one should instruct users to copy the
.tpa file into
C:\TouchGFX\4.13.0\app\packages and restart the designer, if open.
Usually, developers will keep an entire development project (Board bringup, TouchGFX AL, TouchGFX UI) in the same repository which eliminates the need for distributable
.tpa files. However, for team members to be able to start a new TouchGFX application, unified platform code is powerful when it comes to test and verification.
For those that do distribute
.tpa files and/or use tools like
git submodules to modularize their codebase it is wise to let the version of the AT-component follow the version specified in the
.json descriptor mentioned previously in this article. If using a modularized approach, the platform code could still be used to create a distributable
.tpa file while also being used as a module in a main project struture.