Try that: @mark.replace([rec.parent.left+rec.left,rec.parent.top+rec.top].inspect) in your rec.click
K On Mon, Jan 12, 2009 at 2:53 PM, kita yui <[email protected]>wrote: > hi, > I'm sorry if this mail is not proper for I'm a biginner of Ruby or > programming. > I'm wondering how to get the position on a window. > Method like 'left' or 'top' return the position of a object, but they are > not on a window but on flow or stack (when it is in flow or stack). > > I made a sample below. Click any rect, then you'll see the position of it. > Shoes.app do > left=[] > middle=[] > right=[] > flow :height=>600, :width=>600 do > flow :height=>600,:width=>200 do > 12.times do > image 100,100 do > fill green(0.6) > @m=rect 0,0,100,100 > end > left.push(@m) > end > end > flow :height=>600,:width=>200 do > 12.times do > image 100,100 do > fill red(0.6) > @m=rect 0,0,100,100 > end > middle.push(@m) > end > end > flow :height=>600,:width=>200 do > 12.times do > image 100,100 do > fill yellow(0.6) > @m=rect 0,0,100,100 > end > right.push(@m) > end > end > end > @mark=banner(777) > rects=[left,middle,right] > rects.each do |rect| > rect.each do |rec| > rec.click do > @mark.replace([rec.left,rec.top].inspect) > end > end > end > end > Does anyone know how to get the position on a window? > Cheers....Leui > > > ------------------------------ > Power up the Internet with Yahoo! > Toolbar.<http://pr.mail.yahoo.co.jp/toolbar/> >
