dperkins
4/1/2006 3:10:00 PM
> Um, just to try out these %X and %Y objects real quick, I added X, Y, %X
> and %Y to my argument list in the callback proc in the same form as the
> x, y, %x and %y objects to see what would happen, but got the following
> "dynamic constant assignment" and "formal argument" errors:
Anything that begins with a capital letter is a constant, e.g., |b, x, y,
X, Y|. You could replaces X and Y with xx and yy.
> What are these %X and %Y objects, and where can I find some
> documentation on them? But, more to the point, what does the "%"
> leading character on these object names mean? I am looking through the
> pickaxe book, but I'm not finding any reference to "%" outside of the
> modulo operator. Please excuse my "less than ideal" knowledge of Ruby
> syntax and semantics!
An event can pass parameters to a callback. The % tells Ruby/Tk which
event data you want passed to the callback.
%x %y mouse's x and y coordinates in widget.
%X %Y mouse's x and y coordinates in program window.
%W widget mouse is in
There are more variables, but I don't have my notes with me.
A book on Tk or Perl/Tk should have the complete list.