Ev('x') 做甚 ?

Ev('x') 做甚 ?

Ev('x') 做甚 ?
[CCB]10[/CCB]
看到MPTK中

$canvas -> bind("<Motion>",[\&size_item,[b]Ev('x'),Ev('y')[/b]]);

当鼠标掠过canvas时,调动subroutine &size_item, 只是同时要这后面的两Ev做甚...?






   

呵呵,自问自答了~
其实也是刚试出来的.

根据以下例程中返回的参数例表@_可看出,Ev('x')和Ev('y')记下鼠标左键所击处,
然后通过@_返回给$x,$y,通过$canv->canvasx($x),$canv->canvasy($y)返回坐标了,print给你看了.

$canvas->CanvasBind("<Button-1>", [ \&print_xy, Ev('x'), Ev('y') ]);
sub print_xy {
my ($canv, $x, $y) = @_;
print "(x,y) = ", $canv->canvasx($x), ", ", $canv->canvasy($y), "\n";
}

不知理解对不对?!!!