Hi Robert,

Views are instantiated in lexical order, so that your code as written is going to cause an error due to a forward reference. If you rewrite your code not to have the forward reference it should work:

   <window id="win1" x="100" y="100" width="200" height="200" />
   <window id="win2" x="300" y="300" width="200" height="200">
       <handler name="onx" reference="win1">
           this.setX(win1.x+200);
           this.setY(win1.y+200);
       </handler>
   </window>

You might also consider just using constraints:

   <window id="win1" x="100" y="100" width="200" height="200" />
<window id="win2" x="${win1.x+200}" y="${win1.y+200}" width="200" height="200">


On 2007-06-12, at 19:42 EDT, Qrowd Support wrote:

In nightly build 5388, this code causes a DHTML exception in both IE7 and FF:

<canvas id="maincanvas" width="100%" height="100%" validate="false" debug="false" proxied="false" bgcolor="0x00aaaa">
   <debug x="650" y="200" width="800" height="400" fontsize="12"/>

   <window id="win1" x="100" y="100" width="200" height="200">
       <handler name="onx">
           win2.setX(this.x+200);
           win2.setY(this.y+200);
       </handler>
   </window>
<window id="win2" x="300" y="300" width="200" height="200"/> </ canvas>

The exception states that "win2" is not defined...meaning that the onx handler is being invoked before win2 is instantiated and its global identifier is set. Dunno if other handlers are affected, or possibly other handlers on other views.
--
Robert Yeager
Founder, Qrowd
http://www.qrowd.com/blog
http://www.qrowd.com <http://www.qrowd.com>

Reply via email to