Name

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

Synopsis

LZX: basetrackgroup
JavaScript: 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 (5)

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
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:
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 (4)

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
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
setBoundsRef()
<method name="setBoundsRef" args="ref" />
public function setBoundsRef(ref);
sets the view that will act as the bounds for this trackgroup
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

LZX Synopsis

<class name="basetrackgroup" extends=" LzView ">
  <attribute name=" activateevents " value="['onmousedown']" />
  <attribute name=" boundsref " value="${this}" />
  <attribute name=" deactivateevents " value="['onmouseup']" />
  <attribute name=" tracking " value="true" />
  <attribute name=" trackingrate " value="150" />
  <method name=" activateTrackgroup " args="v" />
  <method name=" deactivateTrackgroup " />
  <method name=" setBoundsRef " args="ref" />
  <method name=" trackingout " />
</class>

JavaScript Synopsis

public basetrackgroup extends  LzView  {
  public var activateevents ;
  public var boundsref ;
  public var deactivateevents ;
  public var tracking ;
  public var trackingrate ;
  prototype public function activateTrackgroup (v);
  prototype public function deactivateTrackgroup ();
  prototype public function setBoundsRef (ref);
  prototype public function trackingout ();
}