On Mon, Nov 17, 2008 at 11:58:36PM +0000, Einar Magnús Boson wrote:
> How can I let my widget know the size of its parent? Since it doesn't
> reflow the size should be known when initialize is called and you have to
> agree that it should be considered a bug that in this:
>
> #[.snip..]
> @left = stack(:width => 200) { |s|
> background yellow
> stack {
> rect_width = width*0.8
> @r = rect 0,0, rect_width, 20, :stroke => red,
> :fill => green
> }
> para "col 1"
>
> }
> #[..snip..]
>
> `width` is not the width of the surrounding container but of the entire
> window (as is parent.width). No matter if you agree, it would be s
> convenient that I plead with you to hand size downwards somehow.
Shoes.app do
stack :width => 200 do
background yellow
@var = stack do
3.times { para "TEST STACK" }
start do
rect_width = @var.width * 0.8
@r = @var.rect 0, 0, rect_width, 20,
:stroke => red, :fill => green
end
end
end
end
end
`self` is a confusing thing in Shoes. Read the first two sections of this:
<http://help.shoooes.net/Rules.html>
_why