Skip to content
Brian Spencer edited this page Mar 15, 2017 · 11 revisions

The levure/framework folder contains the levure.livecodescript script-only LiveCode stack which has the Levure library handlers and provides the primary framework functionality. You should not modify any code in this stack or in the supporting framework/helpers folder.

  • 📂 your_project_folder
    • 📂 app
      • standalone.livecode
    • 📁 builds
    • 📂 levure
      • 📂 framework
        • levure.livecodescript
        • 📁 helpers
      • 📁 packager
      • 📁 utils

When your application starts up, the levure.livecodescript stack script is automatically opened and attached to your executable standalone stack as a behavior. The framework script is then placed into the message path with start using so the framework handlers are globally accessible throughout your application.

levureFramework.livecodescript

The framework logic is located in the levure.livecodescript file. The stack must be assigned as the behavior of another stack which is assumed to be the standalone.livecode stack. The levureInitializeAndRunApplication will initialize and load the framework. Here is what happens during loading:

  1. If an sAppA script local exists and the stack is running in the development environment then use values from that. It means the app has been packaged. Otherwise load the app.yml file, searching first alongside the standalone.livecode stack file and then directly within any folders that are alongside the standalone.livecode stack. If app.yml is not found then app cannot be loaded.
  2. Process any command line arguments using the app_files_and_urls helper (if app.yml explicitly loads this helper).
  3. Load app.livecodescript from folder containing the app.yml file.
  4. Load externals.
  5. Load helpers whose "preload" property is true. Any helper that ships with the framework is preloaded. When a helper is loaded all extensions, libraries, backscripts, and frontscripts that make up a helper will be loaded. UI stacks are added to list of stackFiles of the app stack.
  6. Create application data folders.
  7. Dispatch PreloadApplication to the app stack.
  8. Load remaining application assets. Extensions, libraries, backscripts, frontscripts are loaded into memory. UI stacks are added to list of stackFiles of the app stack.
  9. Dispatch InitializeApplication to app stack.
  10. Dispatch OpenApplication to app stack.

Framework helpers

The levure/framework folder also contains a helpers folder which adds additional functionality to the framework. The helpers in the levure/framework/helpers folder should normally not be modified.

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