No prob. This should really get fixed though, maybe cache
position/size until it's drawn?

On Sun, Jul 5, 2009 at 10:18 AM, Ehsanul Hoque<[email protected]> wrote:
> Thanks a lot for that! You saved me an hour or more of working on an ugly
> hack around this.
>
> I am in fact creating objects dynamically, and the code wasn't working, like
> you implied. However, I checked the manual, and it seems like you should use
> the start block inside the stack/flow block, and you hand it the stack
> object in the start block. Then it works. Here's the example code, which
> does what I wanted (the rectangle is drawn to fit in the stack), click to
> see it work:
>
> Shoes.app do
>   def omg
>     stack( :height => 70, :width => 200 ) do
>       border black
>       start do |stacky|
>         stacky.append do
>           nostroke
>           fill( rgb( rand, rand, 1.0, 0.5 ) )
>           rect 0, 0, stacky.width, 25, 10
>           para "This slot has some height and width, surely?"
>         end
>       end
>     end
>   end
>   click { |button,left,top| omg }
> end
>
>
>> Subject: Re: Problem with slot width() and height() methods - Bug?
>> From: [email protected]
>> To: [email protected]
>> Date: Sat, 4 Jul 2009 10:21:39 -0700
>>
>> Yes, that has come up before. If you are not creating the objects
>> dynamically, you can put the height/width detection inside a 'start'
>> block:
>>
>> Shoes.app do
>> @s = stack( :height => 75, :width => 200 ) do
>> border black
>> para "This slot has some height and width, surely?"
>> end
>> start do
>> stack do
>> [ "@s.width = #[email protected]}", "@s.style[:width] = #[email protected][:width]}",
>> "@s.height = #[email protected]}",
>> "@s.style[:height] = #[email protected][:height]}" ].each { |x| para x }
>> end
>> end
>> end
>>
>> On Fri, Jul 3, 2009 at 2:45 PM, Ehsanul Hoque<[email protected]>
>> wrote:
>> > I can't seem to retrieve the height or width of a slot. GIves me 0 as
>> > the
>> > pixel height/width. Not sure if this is a bug in shoes (someone else
>> > must've
>> > noticed this by now) or just something with my system. Here's the code
>> > I've
>> > used to test it anyways, both on raisins and policeman, feel free to try
>> > it
>> > out and see if it gives you the expected result:
>> >
>> > Shoes.app do
>> >   @s = stack( :height => 75, :width => 200 ) do
>> >     border black
>> >     para "This slot has some height and width, surely?"
>> >   end
>> >   stack do
>> >     [ "@s.width = #[email protected]}", "@s.style[:width] =
>> > #[email protected][:width]}",
>> > "@s.height = #[email protected]}",
>> >     "@s.style[:height] =  #[email protected][:height]}" ].each { |x| para x }
>> >   end
>> > end
>> >
>> > ________________________________
>> > Insert movie times and more without leaving Hotmail®. See how.
>>
>>
>>
>> --
>> ~devyn
>
> ________________________________
> Hotmail® has ever-growing storage! Don’t worry about storage limits. Check
> it out.



-- 
    ~devyn

Reply via email to