From: David Bailey Date: 2006-04-01T22:41:56+09:00 Subject: Re: Ruby/Tk (X,Y) Coordinate Question unknown wrote: > You could try "%X %Y" to get coordinates relative to the top left corner > of the program. > > There is also a "%W" that might be useful. If I remember correctly, it > returns the id of the widget the mouse clicked, but it might return the > reference. 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: C:\Documents and Settings\dbailey1\Desktop\Ruby My Dear>ruby sudoku_treasury.rb sudoku_treasury.rb:15: dynamic constant assignment @root.bind('Button', proc{|b,x,y,X,Y| mainCellClickedProc(b, x, y, X, Y)}, "%b %x %y %X %Y") ^ sudoku_treasury.rb:15: dynamic constant assignment @root.bind('Button', proc{|b,x,y,X,Y| mainCellClickedProc(b, x, y, X, Y)}, "%b %x %y %X %Y") ^ sudoku_treasury.rb:68: formal argument cannot be a constant def mainCellClickedProc(btn,x,y,X,Y) ^ sudoku_treasury.rb:68: formal argument cannot be a constant def mainCellClickedProc(btn,x,y,X,Y) ^ sudoku_treasury.rb:116: formal argument cannot be a constant def tell_it(btn, x, y, X, Y) ^ sudoku_treasury.rb:116: formal argument cannot be a constant def tell_it(btn, x, y, X, Y) ^ C:\Documents and Settings\dbailey1\Desktop\Ruby My Dear> 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 ignorance of Ruby syntax and semantics! -- Posted via http://www.ruby-forum.com/.