<basetrackgroup>
used for grouping a set of views responding to mousetrack events.

JavaScript: lz.basetrackgroup
extends <view> » <node> » lz.Eventable »

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>

Attributes

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

Methods

activateTrackgroup()
basetrackgroup.activateTrackgroup(v);
activates the trackgroup for this view. It is called automatically when any subview gets an event from the activateevents set of events
Parameter Name Type Description
v    

deactivateTrackgroup()
basetrackgroup.deactivateTrackgroup(ignore);
deactivates the trackgroup for this view. It is called automatically when any subview gets an event from the deactivateevents set of events
Parameter Name Type Description
ignore    

setBoundsRef()
basetrackgroup.setBoundsRef(ref);
sets the view that will act as the bounds for this trackgroup
Parameter Name Type Description
ref    

trackingout()
basetrackgroup.trackingout(ignore);
Called when the mouse is down and tracked outside the bounding rect defined by boundsref. this method generates the onmousetrackoutleft, onmousetrackoutright, onmousetrackouttop, onmousetrackoutbottom events
Parameter Name Type Description
ignore    

Methods inherited from lz.Eventable

destroy, setAttribute

Events

Events inherited from <node>

onconstruct, ondata, oninit

Events inherited from lz.Eventable

ondestroy