<canvas>

The top-most view in a Laszlo application.

JavaScript: LzCanvas

Extends View

The canvas is the container for all views within an application.

The LzCanvas class represents the viewable area of the application. There is one instance of LzCanvas, named canvas. The canvas contains all views within an application.

The <canvas> tag is the document root of an LZX application file. It contains class, resource, and font definitions, library includes, and view and other instances.

See the Guide for a complete discussion of the <canvas> tag.

Attributes
Name Usage Type (Tag) Type (JS) Default Category
accessible Tag & JS boolean Boolean false setter
 

Specifies if this application is intended to be accessible


build JS only String   readonly
  build number of the LPS that generated this application (for .lzo files, this is the build of the server that generated the optimized file, not the one that served it).

cssfile Tag & JS URL any   setter
 

The CSS file to use for the application.


dataloadtimeout Tag & JS number Number   readonly
  timeout in milliseconds for data load requests

datasets JS only   readonly
  Dictionary of all named datasets.

debug Tag & JS boolean Boolean false setter
 

If true, the application is compiled with debugging enabled. See the Debugging chapter of the Guide for more information about debugging.


embedfonts Tag & JS boolean Boolean true setter

expires JS only String   readonly
  expiration date of this LPS application (based on expiry of server that generated the application, not the one that served it).

libraries Tag & JS string String   setter
 

A list of names for libraries that are included in the application.


lpsrelease JS only String   readonly
  release of the LPS that generated this application (for .lzo files, this is the release of the server that generated the optimized file, not the one that served it).

lpsversion JS only String   readonly
  version number of the LPS that generated this application (for .lzo files, this is the version number of the server that generated the optimized file, not the one that served it).

maxtextheight Tag & JS size Size   setter
 

If present, specifies the maximum height in pixels of any output text field. Text which extends beyond this height will be clipped. If this attribute is omitted, it defaults to the canvas height.


maxtextwidth Tag & JS size Size   setter
 

If present, specifies the maximum width in pixels of any output text field. Text which extends beyond this width will be clipped. If this attribute is omitted, it defaults to the canvas width.


medialoadtimeout Tag & JS number Number   readonly
  timeout in milliseconds for media load requests

onpercentcreated JS only   readonly
  Sent whenever the number of created nodes changes

percentcreated JS only   readonly
  A number from 0-1 that represents the percentage of the app that has been instantiated.

proxied Tag & JS inheritableBoolean boolean inherit readonly
  if true, runtime requests are proxied; if false, runtime requests are direct. initialize canvas.proxied (boolean), from args.proxied (string) arg and query 'lzproxied' arg: 1. If then set from canvas arg. 2. Otherwise, inherit from 'lzproxied' query arg (which defaults to true currently)

title Tag & JS string String OpenLaszlo Application setter
 

The string that is used in the browser window.


validate Tag & JS boolean Boolean true setter
 

If false, disables validation against the schema during compilation


version Tag & JS string Number 1.1 readonly
  The version for this lzx app. If set below the current version, may enable backwards compatible behaviors.


Attributes inherited from Node

class, classroot, cloneManager, datapath, id, ignoreAttribute, ignoreplacement, immediateparent, initstage, name, nodeLevel, onconstruct, oninit, parent, placement, subnodes

Attributes inherited from View

aaactive, aadescription, aaname, aasilent, aatabindex, align, bgcolor, clickable, clickregion, clip, cursor, defaultplacement, fgcolor, focusable, focustrap, font, fontsize, fontstyle, frame, framesloadratio, hassetheight, hassetwidth, height, layout, loadratio, mask, onblur, onclick, ondata, ondblclick, onfocus, onkeydown, onkeyup, onmousedown, onmouseout, onmouseover, onmouseup, onselect, opacity, options, pixellock, play, resource, resourceheight, resourcewidth, rotation, selectiontype, showhandcursor, source, stretches, subviews, totalframes, unstretchedheight, unstretchedwidth, valign, visible, width, x, xoffset, y, yoffset


Methods

compareVersion()
LzCanvas.compareVersion(ver, over)

Compares two version strings.

Parameters
Name Type Desc
ver A version string
over Another version string. If omitted, defaults to the version of of the app.
Returns
Type Desc
-1, 0 , 1 to indicate whether the ver parameter preceeds, matches, or succeeds the second parameter (respectively)


constructor()
LzCanvas(args)
Parameters
Name Type Desc
args None


setContextMenu()
LzCanvas.setContextMenu(cmenu)
Parameters
Name Type Desc
cmenu a ContextMenu sets the right click menu for the canvas


setDefaultContextMenu()
LzCanvas.setDefaultContextMenu(cmenu)
Parameters
Name Type Desc
cmenu a ContextMenu sets the right click menu on the canvas and as the default menu for all views


Methods inherited from LzNode

animate, applyConstraint, applyData, childOf, completeInstantiation, createChildren, dataBindAttribute, destroy, determinePlacement, getAttribute, getOption, getUID, lookupSourceLocator, searchImmediateSubnodes, searchSubnodes, setAttribute, setDatapath, setID, setName, setOption

Methods inherited from LzView

addProxyPolicy, addSubview, bringToFront, construct, containsPt, getAttributeRelative, getBounds, getColor, getColorTransform, getContextMenu, getCurrentTime, getDepthList, getHeight, getID3, getMouse, getPan, getTotalTime, getVolume, getWidth, init, measureHeight, measureWidth, play, releaseLayouts, removeProxyPolicy, searchParents, searchSubviews, seek, sendBehind, sendInFrontOf, sendToBack, setAAActive, setAADescription, setAAName, setAASilent, setAATabIndex, setAlign, setAttributeRelative, setBGColor, setClickable, setColor, setColorTransform, setContextMenu, setCursor, setHeight, setLayout, setOpacity, setPan, setPlay, setResource, setResourceNumber, setRotation, setShowHandCursor, setSource, setValign, setVisible, setVolume, setWidth, setX, setY, shouldYieldFocus, stop, stretchResource, unload, updateResourceSize


Events
Name Description
oninit None

Events inherited from LzNode

onconstruct, ondata, oninit

Events inherited from LzView

onaddsubresource, onaddsubview, onblur, onclick, ondblclick, onerror, onfocus, onframe, onheight, onlastframe, onload, onmousedown, onmousedragin, onmousedragout, onmouseout, onmouseover, onmouseup, onmouseupoutside, onopacity, onplay, onremovesubview, onstop, ontimeout, onwidth, onx, ony