tspratt
02-20-2004, 01:48 PM
When set up declaratively everything works fine, and "this" can be passed to another handler.
But when the Target is instantiated, and the event is created using LzDelegate, the onmousetrackup event does not pass back a reference to the source. OnmousetrackOver and out on the other hand do pass the reference. Try this code:
<canvas debug="true">
<debug x="150"/>
<method event="oninit">
  var oControl = new LzView(canvas);
  oControl.setAttribute("bgcolor",0xE7EED6);
  oControl.setAttribute("height", "100");
  oControl.setAttribute("width", "100");
  oControl.setAttribute("y", "75");
  oControl.setAttribute("clickable", true);
  oControl.setAttribute("id", "viewTarget");
  var lzdel = new LzDelegate( canvas, "global_onmousetrackover", oControl, "onmousetrackover" );
  var lzdel = new LzDelegate( canvas, "global_onmousetrackup", oControl, "onmousetrackup" );
  LzTrack.register(viewTarget, "DropTargets");
</method>
<method name="global_onmousetrackover" args="oControl">
  debug.write("onmousetrackOver: " + oControl.getAttribute("id"));
</method>
<method name="global_onmousetrackup" args="oControl">
  debug.write("onmousetrackUp: " + oControl.getAttribute("id"));
</method>
<view id="viewSource" width="50" height="50" bgcolor="0xEEE7D6" >
  <text text="drag me down" width="200"/>
  <method event="onmousedown">
  LzTrack.activate("DropTargets");
  </method>
  <method event="onmouseup">
  LzTrack.deactivate("DropTargets");
  </method>
</view>
</canvas>
Can you reproduce this behavior?
Tracy
But when the Target is instantiated, and the event is created using LzDelegate, the onmousetrackup event does not pass back a reference to the source. OnmousetrackOver and out on the other hand do pass the reference. Try this code:
<canvas debug="true">
<debug x="150"/>
<method event="oninit">
  var oControl = new LzView(canvas);
  oControl.setAttribute("bgcolor",0xE7EED6);
  oControl.setAttribute("height", "100");
  oControl.setAttribute("width", "100");
  oControl.setAttribute("y", "75");
  oControl.setAttribute("clickable", true);
  oControl.setAttribute("id", "viewTarget");
  var lzdel = new LzDelegate( canvas, "global_onmousetrackover", oControl, "onmousetrackover" );
  var lzdel = new LzDelegate( canvas, "global_onmousetrackup", oControl, "onmousetrackup" );
  LzTrack.register(viewTarget, "DropTargets");
</method>
<method name="global_onmousetrackover" args="oControl">
  debug.write("onmousetrackOver: " + oControl.getAttribute("id"));
</method>
<method name="global_onmousetrackup" args="oControl">
  debug.write("onmousetrackUp: " + oControl.getAttribute("id"));
</method>
<view id="viewSource" width="50" height="50" bgcolor="0xEEE7D6" >
  <text text="drag me down" width="200"/>
  <method event="onmousedown">
  LzTrack.activate("DropTargets");
  </method>
  <method event="onmouseup">
  LzTrack.deactivate("DropTargets");
  </method>
</view>
</canvas>
Can you reproduce this behavior?
Tracy