Hi Szymon, You appear to have stumbled on a really fascinating bug. From what I can tell, shoes is trying to use your opts hash for its internal layout stuff, and getting confused between your x/y/width/height and its own. You can work around the problem by using opts[:x1], opts[:y1], opts[:width1], and opts[:height1].
My guess is this is happening because _why wanted to enable widgets in general to just invisibly have all of the typical Shoes layout options, but in this case it seems to have backfired. -Kevin On Sat, Jan 24, 2009 at 8:23 AM, Szymon Wrozynski sw <[email protected]> wrote: > Hello, > > Could you point me what's wrong here? > > The code: > > class Cell1 < Shoes::Widget > def initialize(opts={}) > @x = opts[:x] > @y = opts[:y] > @width = opts[:width] > @height = opts[:height] > paint > end > > def paint > fill(white) > rect(@x, @y, @width, @height) > line(@x, @y, @x + @width, @y) > line(@x, @y, @x, @y + @height) > line(@x + @width, @y, @x + @width, @y + @height) > line(@x, @y + @height, @x + @width, @y + @height) > end > end > > class Cell2 < Shoes::Widget > def initialize(x, y, width, height) > @x = x > @y = y > @width = width > @height = height > paint > end > > def paint > fill(white) > rect(@x, @y, @width, @height) > line(@x, @y, @x + @width, @y) > line(@x, @y, @x, @y + @height) > line(@x + @width, @y, @x + @width, @y + @height) > line(@x, @y + @height, @x + @width, @y + @height) > end > end > > Shoes.app do > cell1(:x=>100, :y=>100, :width=>100, :height=>100) # doesn't work!! > cell2(100, 100, 100, 100) # works ok > end > > > The paint methods are the same. > Is it a bug? Why it doesn't work while passing a hash? The console says > nothing. > > As usually any help will be blessed. > > kind regards > > sw >
