Curl5 detached applets and the Surge RTE

To launch the CURL5 documentation execute

“I:\Curl RTE\Surge\6\bin\surge-do.exe” - - ide 0 show-guide

where “I:” is the drive where you installed the Curl Surge runtime environment.

By doing a search on ‘detached’ you will find the concept of a ‘detached applet’ or an applet running outside of the browser. That same page has the documentation for Curl scripts.

Curl applets outside the browser have a .dcurl extension and can be created in the CURL IDE as a new file. The template is as follows:

{curl 5.0 applet}
{curl-file-attributes character-encoding = "windows-latin-1"}

{View
    || Replace {Frame} with your code.
    {Frame width = 8cm, height = 8cm},
    visibility = "normal",
    {on WindowClose do
        {exit 0}
    }
}

You could also experiment with interactive Curl at the command line with

"I:\Curl RTE\Surge\6\bin\curl.exe" --shell

Replace --shell with --help to see options.

From a shell console, you must

do {import * from CURL.GUI.STANDARD}

to have access to the View class. View is in the package CURL.GUI.BASE, but the other package is a Curl ‘convenience’ or ’super’ package which includes BASE, CONTROLS and other applet essentials including CURL.UTIL.ELASTIC for stretch-y widgets which re-size themselves.

Launching the Curl IDE from the command line uses

"I:\Curl RTE\Surge\6\bin\surge-do.exe" --ide 0 show-main

To run a script in a browser use

"I:\Curl RTE\Surge\6\bin\surge-browse.exe" some-script.curl

Curl scripts use the .xcurl extension. Whether the script is graphical or character-mode depends on the libraries which you import.

Elsewhere in these notes I cover the extensions .curl, .scurl and .pcurl

The usual approach is to assign the View as follows

let win:View = {View {Frame …

so that you can follow with

{win.show}
{event-loop}

Take note that the {exit} will kill an opener console shell but when deployed a detached applet must call exit. Here is a quote from the Curl documentation on detached applets:

• Users view a detached applet as a stand-alone application.

 • Detached applets use the .dcurl extension and
      text/vnd.curl.dcurl MIME type.

 • Detached applets have no default View.

 • Detached applets are never suspended.

 • Detached applets must call exit explicitly.

 • You must use the special
       curl://launch/
    prefix in front of the URL for a detached applet.

If you have reason to use aView.hide to avoid aView.destroy then you must also remember to have your handler for WindowClose consume the event!

Leave a Reply

You must be logged in to post a comment.