Skip to content
Trevor DeVore edited this page Mar 13, 2017 · 20 revisions

The helpers folder sits alongside the app.yml file in your application folder. The helpers folder is for files that work together to add a specific piece of functionality to an application. The folder can contain stack files meant to be used for UI, libraries, frontscripts, or backscripts. It can also contain externals or extensions.

Update helpers section in app.yml

Whenever you add or remove a helper be sure to update the helpers section of app.yml. This enables the framework to properly load your helpers at startup.

# app.yml
...
helpers:
  1:
    filename: [relative path to folder containing helper]
    encrypt: Optional parameter that can override the `encrypt stacks` setting for this stack.
  2:
    folder: [relative path a folder with helper folders]
    encrypt: Optional parameter that can override the `encrypt stacks` setting for all stacks in the folder.
  ...
...

Helpers consist of a folder with a helper.yml file in it. The helper.yml file specifies what the other files in the folder should be used for. A helper can be made up of the following:

  • ui
  • libraries
  • backscripts
  • frontscripts
  • behaviors
  • externals
  • extensions

If no helper.yml file is found then the framework will try to load up each file in the folder as a stack.

If your helper includes an extension then you can also specify a resource folder for the extension. This is the folder where any resources that your widget loads will come from. For example, if you use image from resource file mResource and it is a relative reference then the LiveCode engine will look in the resource folder.

If no resource file is specified and a ./resources folder exists alongside your app.yml file then that folder will be used.

Helper Components Included with Framework

The framework ships with a number of helpers that you can use in your application. To load a helper use the {{FRAMEWORK}} variable. Example:

helpers:
  1:
    filename: {{FRAMEWORK}}/helpers/preferences

Any helpers included with the framework automatically has its preload flag set to true. That means the helper will be loaded before the PreloadApplication message is sent.

./helpers/files_and_urls

Helps with files associated with your application, managing a recent files list, as well as when the OS asks your application to process a url. Also includes functions for generating file dialog type filter strings.

ProcessFiles message sent to app stack. Check appGetFilesToProcessOnOpen when app opens for files passed on command line.

ProcessURL message sent to app stack. Check appGetURLsToProcessOnOpen() when app opens for urls passed on the command line.

./helpers/broadcaster

API for broadcasting and listening for messages.

./helpers/translate

API for providing translated versions of strings in your app. When you call translateSetLocale the library looks for a ./locales/[LANG_CODE].yml file alongside your app.yml file.

./helpers/logger

API for setting up a log file. Has option to log internet traffic. Turning it on will intercept the ulLogit message that libURL uses and log those messages to your log file.

./helpers/preferences

API for managing your application preferences. On OS X and external is used so that you can set preferences using the OS X APIs. On Windows and Linux preferences are stored in a file containing data serialized using arrayEncode.

./helpers/undo_manager

Manage undo in your application.

./helpers/window_manager

Manages windows in your application. Set a flag on a stack and it's position will be stored across sessions. Also keeps stacks on screen when the desktopChanged message is received.

Clone this wiki locally