Michael Saelee wrote:
Hi folks,

I just started working through examples in the Shoes manual, and am trying:

Shoes.app do
  stack :width => 200, :height => 200 do
    background red
    hover { clear { background blue } }
    leave { clear { background red  } }
  end
end

As I understand it, the (initially red) stack should turn its background blue on mouse entry, then turn red again when the cursor leaves. When I test it, however, the entire app window turns blue on entry, and I can't get it to turn red again. Am I doing something wrong, not getting how it's supposed to work, or is this a bug?

I'm running Shoes 0.r1091 on a PowerPC (OS X 10.5.5).

I know that Seth already answered, but I have a somewhat different approach than his, and I wanted to share.

The way I'd go after it is to stack two backgrounds on top of each other, and the show/hide the top one when the hover happens:

Shoes.app do
  stack :width => 200, :height => 200 do
    red_bg = background red
    blue_bg = background blue
    blue_bg.hide
    hover { blue_bg.show }
    leave { blue_bg.hide }
  end
end

One thing I noticed when playing with this: it looks like the leave event doesn't fire when you move your mouse into the stack and then out of the window. Interestingly enough, it does fire if you bring your mouse back into the window but outside of the stack. It's hard to explain, but it becomes obvious with a couple of added puts:

Shoes.app do
  stack :width => 200, :height => 200 do
    red_bg = background red
    blue_bg = background blue
    blue_bg.hide
    hover { puts "hover"; blue_bg.show }
    leave { puts "leave"; blue_bg.hide }
  end
end

This behavior is not what I would expect. Is it a bug, or is there something I'm missing?

--
Bem Jones-Bey ([EMAIL PROTECTED])

Reply via email to