Shishir, I commend you on the excellent test case. Hooray for short test cases!

I'm not familiar with this particular area of the code, but I believe there have been various bugs around global and local positions inside an inputtext.

To help Max track it down -- which browser are you using, and which runtime?

To make it an even better test, you could add a writeln or a comment about what value is expected versus what value you actually see -- something like:
Debug.print('Expected 27 for local.green_x, got %d" , local.green_x);

I also invite you to search jira (http://jira.openlaszlo.org) for bugs about positioning within inputtext's -- especially look for recently-modified bugs.

Finally, please try this in a recent nightly build from trunk.

Thanks for participating in open source distributed quality assurance!

-ben

On Dec 31, 2007, at 1:33 PM, Shishir Ramam wrote:

Hi,
Perhaps this is a noob misunderstanding - but the following is the simplest script I
could muster that shows the issue.

The intent is to instantiate an element on a mouse click, at the position of the mouse click. I am having trouble deciphering the difference between the global and local mouse events.

Within the window in the script below, x=0,y=0 seems to be indexed of the window area accounting for the border. However, the canvas_click and local_click are essentially at the same point.

The issue with this is that the local_click and canvas_click are being instantiated offset by the title bar height and
border wrt the actual mouse click.

Would this be a bug or am I doing something wrong?
Any help is much appreciated.

I am using the 4.0.7 SDK to build this.

thanks,
-shishir


<canvas debug="true">
  <handler name="onclick" reference="LzGlobalMouse">
Debug.write('Global onclick x:' + canvas.getMouse('x') + ' y:' + canvas.getMouse('y'));
  </handler>

  <class name="myshow" extends="inputtext">
  </class>

<window name="mywindow" x="1" width="25%" height="25%" clickable="true">
    <handler name="onclick">
var local_zero = new myshow (mywindow, { x:"0", y:"0", width:"10", height:"10", bgcolor:"0xff0000"}); var canvas_click = new myshow (mywindow, { x:canvas.getMouse ('x'), y:canvas.getMouse('y'), width:"12", height:"12", bgcolor:"0x00ff00"}); var local_click = new myshow (mywindow, { x:mywindow.getMouse ('x'), y:mywindow.getMouse('y'), width:"10", height:"10", bgcolor:"0x0000ff"}); Debug.write('Local onclick canvas_click(green) x:' + canvas_click.x + ' y:' + canvas_click.y + '; local_click(blue) x:' + local_click.x + ' y:' + local_click.y);
    </handler>
  </window>
</canvas>

Reply via email to