super.construct(parent, args); this._activateDL = new LzDelegate(this,'activateTrackgroup'); this._deactivateDL = new LzDelegate(this,'deactivateTrackgroup'); this._repeattrackDL = new LzDelegate(this,'trackingout'); this._destroyDL = new LzDelegate(this,'destroyitem'); this._trackgroup = "tg" + this.getUID(); this._boundstrackgroup = "btg" + this.getUID(); super.init(); lz.Track.register( this.boundsref, this._boundstrackgroup ); this.boundsref = ref; if ( this.onboundsref ) this.onboundsref.sendEvent(); this.tracking = istracking; if ( this.isinited ) { if ( istracking ) { // have global lz.Track service activate this group lz.Track.activate(this._trackgroup) lz.Track.activate(this._boundstrackgroup) } else { // have global lz.Track service deactivate this group lz.Track.deactivate(this._trackgroup) lz.Track.deactivate(this._boundstrackgroup) } } if ( this.ontracking ) this.ontracking.sendEvent( istracking ); this.setTracking(true); this._destroyDL.register( v, "ondestroy" ); this.setTracking(false); this.setTracking(false); = this.boundsref.width) { if ( this.boundsref.onmousetrackoutright ) this.boundsref.onmousetrackoutright.sendEvent( mx ) } if ( my <= 0 ) { if ( this.boundsref.onmousetrackouttop ) this.boundsref.onmousetrackouttop.sendEvent( my ) } else if ( my >= this.boundsref.height ) { if ( this.boundsref.onmousetrackoutbottom ) this.boundsref.onmousetrackoutbottom.sendEvent( my - this.boundsref.height ) } ]]> used for grouping a set of views responding to mousetrack events.

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>