create()

Creates a new SVG canvas handler.

Syntax

create( name STRING )
 RETURNS SMALLINT
  1. name is the name of the CSS style.

Usage

This function creates a new SVG canvas handle by using the form field name passed as parameter.

Note: The window/form containing the fglsvgcanvas web component field must be created before calling this function.

The name is used to bind the WEBCOMPONENT form field with the SVG canvas, to display SVG content.

The function returns the id of the newly-created SVG canvas. This id must be used in subsequent calls to fglsvgcanvas functions.

When the SVG canvas is no longer needed, free the allocated resources with the destroy() function.

Example

Form file:

...
ATTRIBUTES
WEBCOMPONENT cv = FORMONLY.canvas,
   COMPONENTTYPE = "fglsvgcanvas",
   PROPERTIES = (selection="item_selection"),
   SIZEPOLICY = FIXED,
   STRETCH = BOTH,
   SCROLLBARS = NONE
;
...

Program code:

DEFINE cid SMALLINT
LET cid = fglsvgcanvas.create("formonly.canvas")
...
CALL fglsvgcanvas.destroy( cid )