On Fri, May 22, 2009 at 12:04:35PM +0000, Ehsanul Hoque wrote:
> Ahh, well I did expect it to work like that, hmmm... It still
> could be justified I suppose, it's really upto _why whether
> it's a bug, or just a "feature", just how it works.

Until the image is drawn, you can't really know `top` and `left`.

For instance, let's say you're using percentages:

  Shoes.app do
    o = oval :top => "50%", :left => "50%", :radius => 20
    para "Oval is at (#{oval.top}, #{oval.left})"
  end

Until we compute the window size, the coordinates can't be shown.
So, what you do is get the coordinates in the `start` block:

  Shoes.app do
    o = oval :top => "50%", :left => "50%", :radius => 20
    start do
      para "Oval is at (#{oval.top}, #{oval.left})"
    end
  end

Because the start block runs after the first paint.

It still feels like a bug, but I'm not sure if I want to recompute
every slot each time a new element is added. I will probably have
`top` and `left` and `width` and so on return exceptions if you
try to use them before the window is painted... I don't know.

_why

Reply via email to