librelist archives

« back to archive

Image is drawn outside stack

Image is drawn outside stack

From:
Roald
Date:
2013-07-13 @ 00:27
Does image not create itself inside the parent stack?

I have code that's like:

     stack(:width => 700, :height 700) do
       @pic = image "#{image_filename}"
       @pic.style(height: 400, width: 400)
     end

But the image ends up outside the stack!
What's going on?

Roald

Re: [shoes] Image is drawn outside stack

From:
ashbb
Date:
2013-07-13 @ 08:44
Hi Roald,

> the image ends up outside the stack!
Umm,... strang.
What platform are you using?
I'm using Windows 7. The image is inside the stack with both Shoes 3 and 4.

Could you share your whole code?

ashbb

Re: [shoes] Image is drawn outside stack

From:
ashbb
Date:
2013-07-15 @ 12:22
Hi Roald,

Thanks for the code. I understood your problem. ;-)

You have to append the image to the slot by yourself.
Because you are creating an image element in the button block.

Try out this snippet.

s = stack(:width => 700, :height => 700) do
  background "#00D0FF"
  @i = -1
  btn = button("Next").click do
    if @pic
      @pic.remove; @name.remove
    end
    @i = @i + 1
    @i = 0 if @i == list_of_pictures.length
    s.append do
      @pic = image "#{list_of_pictures[@i]}"
      @pic.style(height: 400, width: 400)
      @name = para "#{list_of_pictures[@i]}"
    end
  end  # btn
end  # stack

Regards,
ashbb

Re: [shoes] Image is drawn outside stack

From:
Roald
Date:
2013-07-15 @ 21:10
Thanks Ash!
Thank you very much.
I would have given up programming a long time ago without you guys!

Where did you guys learn all this?
I look at the documentation and can't seem to find what I'm looking for!

Roald

Re: [shoes] Image is drawn outside stack

From:
Tobias Pfeiffer
Date:
2013-07-15 @ 21:50
Glad we can help :-)

A lot of it is experience. ashbb certainly is one of the most 
experienced shoesers out here - he has writen many shoes applications 
(so have many on this list) and he has even implemented a shoes version 
(green shoes) :-) So there's a lot of experience.

If you'd have any pointers on how to make the documentation better for 
you, please shoot! I also don't really love the organization of the 
current manual (it often takes me some clicking and guessing to get to 
the page I'm looking for).

Cheers,
Tobi

On Mon 15 Jul 2013 11:10:19 PM CEST, Roald wrote:
> Thanks Ash!
> Thank you very much.
> I would have given up programming a long time ago without you guys!
>
> Where did you guys learn all this?
> I look at the documentation and can't seem to find what I'm looking for!
>
> Roald
>