Name

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

Synopsis

LZX: basetrackgroup
JavaScript: lz.basetrackgroup
Type: Class
Access: public
Topic: Components.Base Components
Declared in: lps/components/base/basetrackgroup.lzx

Description

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.setBGColor(0x00FF00);
                 else this.setBGColor(0xFF0000)
                </method>
            
                <method name="setSelect" args="isSelect">
                  if (isSelect) this.setBGColor(0x0000FF);
                  else this.setBGColor(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>

Superclass Chain

node (LzNode) » view (LzView) » basetrackgroup

Known Subclasses

Details

Properties (7)

activateevents
<attribute name="activateevents" value="['onmousedown']" />
public var activateevents;
an array of events which will activate tracking. By default: ['onmousedown']. To override, you must declare as once. For example:
boundsref
<attribute name="boundsref" value="${this}" />
public var boundsref;
The view that will be used to define the bounding rect for tracking the mouse
_boundstrackgroup
<attribute name="_boundstrackgroup" />
private var _boundstrackgroup;
deactivateevents
<attribute name="deactivateevents" value="['onmouseup']" />
public var deactivateevents;
an array of events which will deactivate tracking. By default: ['onmouseup']. To override, you must declare as once. For example:
_trackgroup
<attribute name="_trackgroup" />
private var _trackgroup;
tracking
<attribute name="tracking" value="true" />
public var tracking;
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
<attribute name="trackingrate" value="150" />
public var trackingrate;
The periodic rate in milliseconds to track the mouse

Methods (9)

activateTrackgroup()
<method name="activateTrackgroup" args="v" />
public function activateTrackgroup(v);
activates the trackgroup for this view. It is called automatically when any subview gets an event from the actiavteevents set of events
construct()
<method name="construct" />
private function construct();
deactivateTrackgroup()
<method name="deactivateTrackgroup" />
public function deactivateTrackgroup();
deactivates the trackgroup for this view. It is called automatically when any subview gets an event from the deactiavteevents set of events
destroy()
<method name="destroy" />
private function destroy();
destroyitem()
<method name="destroyitem" />
private function destroyitem();
init()
<method name="init" />
private function init();
setBoundsRef()
<method name="setBoundsRef" args="ref" />
public function setBoundsRef(ref);
sets the view that will act as the bounds for this trackgroup
setTracking()
<method name="setTracking" args="istracking" />
private function setTracking(istracking);
trackingout()
<method name="trackingout" />
public function trackingout();
Called when the mouse is down and tracked outside the bounding rect defined by boundsref. this method generates the onmousetrackoutleft, onmousetrackoutright, onmousetrackouttop, onmousetrackoutbottom events

Events (6)

onboundsref
<attribute name="onboundsref" />
private event onboundsref;
onmousetrackoutbottom
<attribute name="onmousetrackoutbottom" />
private event onmousetrackoutbottom;
onmousetrackoutleft
<attribute name="onmousetrackoutleft" />
private event onmousetrackoutleft;
onmousetrackoutright
<attribute name="onmousetrackoutright" />
private event onmousetrackoutright;
onmousetrackouttop
<attribute name="onmousetrackouttop" />
private event onmousetrackouttop;
ontracking
<attribute name="ontracking" />
private event ontracking;

LZX Synopsis

<class name="lz.basetrackgroup" extends=" LzView ">
  <attribute name=" activateevents " value="['onmousedown']" />
  <attribute name=" boundsref " value="${this}" />
  <attribute name=" _boundstrackgroup " />
  <attribute name=" deactivateevents " value="['onmouseup']" />
  <attribute name=" _trackgroup " />
  <attribute name=" tracking " value="true" />
  <attribute name=" trackingrate " value="150" />
  <method name=" activateTrackgroup " args="v" />
  <method name=" construct " />
  <method name=" deactivateTrackgroup " />
  <method name=" destroy " />
  <method name=" destroyitem " />
  <method name=" init " />
  <event name=" onboundsref " />
  <event name=" onmousetrackoutbottom " />
  <event name=" onmousetrackoutleft " />
  <event name=" onmousetrackoutright " />
  <event name=" onmousetrackouttop " />
  <event name=" ontracking " />
  <method name=" setBoundsRef " args="ref" />
  <method name=" setTracking " args="istracking" />
  <method name=" trackingout " />
</class>

JavaScript Synopsis

public lz.basetrackgroup extends  LzView  {
  public var activateevents ;
  public var boundsref ;
  private var _boundstrackgroup ;
  public var deactivateevents ;
  private var _trackgroup ;
  public var tracking ;
  public var trackingrate ;
  prototype public function activateTrackgroup (v);
  prototype private function construct ();
  prototype public function deactivateTrackgroup ();
  prototype private function destroy ();
  prototype private function destroyitem ();
  prototype private function init ();
  prototype private event onboundsref ;
  prototype private event onmousetrackoutbottom ;
  prototype private event onmousetrackoutleft ;
  prototype private event onmousetrackoutright ;
  prototype private event onmousetrackouttop ;
  prototype private event ontracking ;
  prototype public function setBoundsRef (ref);
  prototype private function setTracking (istracking);
  prototype public function trackingout ();
}