Home
Categories
Dictionnary
Download
Project Details
Changes Log
FAQ
License

Script helper and context


The global context and helper are available in all the scripts.

The context is available through the context field in your script. For example:

      public void clicked() {
         context.echo("Hello World");
      }

The script helper is available through the helper field in your script. For example:

      public void clicked() {
         XULWidget widget = helper.getCurrentWidget();
      }

Example

For example to show a message on the logger in a Groovy script:

      public void clicked() {
        context.echo("My value:" + value);
      }

To get the current widget in a Groovy script:

      public void clicked() {
         XULWidget widget = helper.getCurrentWidget();
      }

Using a custom context and helper

Main Article: ScriptContext

It is possible to use a custom XULScriptContext and XULScriptHelper rather than the default ones proposed by the API.

This can be useful if you want to add methods to access your own Java application API.

See also


Categories: scripts

Copyright 2008-2020 Herve Girod. All Rights Reserved. Documentation and source under the LGPL licence