A utility class which simplifies tracking of cursor movement across a set of views while in a mousedown state. This involves creating a trackgroup with a unique ID and the registering of any views associated with that trackgroup.
basetrackgroup
handles this
automatically. It creates the unique trackgroup name and automatically
registers its subviews to be tracked by the group. A developer needs
to create the methods within the subviews to respond to the set of
mousetrack events.
The example below displays four colored rectangles within a
basetrackgroup
layed out vertically. The
rectangles respond to the various moustrack events by changing their
background colors. Try pressing the mouse down on one square, and
dragging across the other squares.
<canvas
height
="200
">
<include
href
="/base/basetrackgroup.lzx
"/>
<class
name
="testview
" bgcolor
="red
" width
="100%
" height
="30
" clickable
="true
">
<handler
name
="onmousetrackover
">
this.setHilite(true);
</handler
>
<handler
name
="onmousetrackout
">
this.setHilite(false);
</handler
>
<handler
name
="onmousetrackup
">
this.setSelect(true);
</handler
>
<method
name
="setHilite
" args
="ishilite
">
if (ishilite ) this.setAttribute('bgcolor', 0x00FF00);
else this.setAttribute('bgcolor', 0xFF0000)
</method
>
<method
name
="setSelect
" args
="isSelect
">
if (isSelect) this.setAttribute('bgcolor', 0x0000FF);
else this.setAttribute('bgcolor', 0xFF0000)
</method
>
</class
>
<basetrackgroup
x
="20
" y
="20
" width
="100
" height
="200
">
<testview
name
="v1
"/>
<testview
name
="v2
"/>
<testview
name
="v3
"/>
<testview
name
="v4
"/>
<simplelayout
axis
="y
" spacing
="10
"/>
</basetrackgroup
>
</canvas
>
Name (CSS property) | Type (tag) | Type (js) | Default | Category |
---|---|---|---|---|
activateevents
|
expression | any | ['onmousedown'] | read/write |
an array of events which will activate tracking.
To override, you must declare as once. For example:
<attribute name="activateevents" value="['onmouseover']" when="once"/> |
||||
boundsref
|
expression | any | this | read/write |
The view that will be used to define the bounding rect for tracking the mouse | ||||
deactivateevents
|
expression | any | ['onmouseup'] | read/write |
an array of events which will deactivate tracking.
To override, you must declare as once. For example:
<attribute name="deactivateevents" value="['onmouseover']" when="once"/> |
||||
tracking
|
expression | any | true | read/write |
Indicates if this trackgroup is currently tracking or not. It can bet set to turn tracking on or off, or use the methods activatetrackgroup and deactivatetrackgroup | ||||
trackingrate
|
expression | any | 150 | read/write |
The periodic rate in milliseconds to track the mouse |
aaactive, aadescription, aaname, aasilent, aatabindex, align, backgroundrepeat, bgcolor, cachebitmap, capabilities, clickable, clickregion, clip, colortransform, context, contextmenu, cornerradius, cursor, fgcolor, focusable, focustrap, font, fontsize, fontstyle, frame, framesloadratio, hasdirectionallayout, hassetheight, hassetwidth, height, layout, loadratio, mask, opacity, pixellock, playing, proxyurl, resource, resourceheight, resourcewidth, rotation, shadowangle, shadowblurradius, shadowcolor, shadowdistance, showhandcursor, source, stretches, subviews, tintcolor, totalframes, unstretchedheight, unstretchedwidth, usegetbounds, valign, visibility, visible, width, x, xoffset, xscale, y, yoffset, yscale
classroot, cloneManager, data, datapath, defaultplacement, id, ignoreplacement, immediateparent, inited, initstage, name, nodeLevel, options, parent, placement, styleclass, subnodes, transition
Methods
activateTrackgroup() |
---|
deactivateTrackgroup() |
---|
setBoundsRef() |
---|
trackingout() |
---|
bringToFront, containsPt, getAttributeRelative, getBounds, getColor, getColorTransform, getCurrentTime, getDepthList, getDisplayObject, getID3, getMouse, getNextSelection, getPan, getPrevSelection, getProxyURL, getTotalTime, getVolume, init, isBehind, isInFrontOf, isMouseOver, measureHeight, measureWidth, play, proxyurl, searchSubviews, seek, sendAAEvent, sendBehind, sendInFrontOf, sendToBack, setAccessible, setAttributeRelative, setColor, setColorTransform, setPan, setProxyPolicy, setSource, setVolume, shouldYieldFocus, stop, unload, updateResourceSize
animate, applyConstraintMethod, applyData, childOf, completeInstantiation, construct, createChildren, dataBindAttribute, destroy, determinePlacement, getOption, getUID, init, lookupSourceLocator, releaseConstraint, releaseConstraintMethod, searchImmediateSubnodes, searchSubnodes, setOption, setSelected, updateData
Events
onaddsubview, onbackgroundrepeat, onblur, onclick, onclickable, onclip, oncontext, oncornerradius, ondblclick, onerror, onfocus, onframe, onframesloadratio, ongesture, onheight, onkeydown, onkeyup, onlastframe, onload, onloadratio, onmousedown, onmousedragin, onmousedragout, onmouseout, onmouseover, onmousetrackout, onmousetrackover, onmousetrackup, onmouseup, onmouseupoutside, onopacity, onplay, onplaying, onremovesubview, onshadowangle, onshadowblurradius, onshadowcolor, onshadowdistance, onstop, ontimeout, ontouch, onvisible, onwidth, onx, ony
Copyright © 2002-2010 Laszlo Systems, Inc. All Rights Reserved. Unauthorized use, duplication or distribution is strictly prohibited. This is the proprietary information of Laszlo Systems, Inc. Use is subject to license terms.