I was doing the same at the beginning but later I decided to put the
rectangles filing the slot and change the fill color of the rectangles on
hover/leave. I think it was more reliable and easier for me that to clearing
the slot. If you want to have a look I created a class emulating a Table (
http://the-shoebox.org/apps/101) where I am using this approach. I cannot
tell, what approach is better from the performance point of view.

regards

Krzys

On Mon, Nov 17, 2008 at 7:00 AM, Seth Thomas Rasmussen <
[EMAIL PROTECTED]> wrote:

> So, this is how I'm changing the background color of a slot on hover
> at the moment:
>
> commits_for_page.each_with_index do |commit,i|
>  bg = i%2==0 ? gray(0.9) : white
>  @commits_list[i] = stack { commit_list_item commit, bg }
>
>  @commits_list[i].click { view_commit commit }
>  @commits_list[i].hover { @commits_list[i].clear { commit_list_item
> commit, green } }
>  @commits_list[i].leave { @commits_list[i].clear { commit_list_item
> commit, bg } }
> end
>
> There were a couple things that tripped me up as I was working this out.
>
> - The context in the hover/leave block is not the slot it is attached to
> - Referencing the slot from withing the hover/leave block and calling
> background() paints over the existing contents
>
> These are both things I realized I was aware of after the fact, but
> apparently it wasn't what I expected while working things out.
>
> Just sharing to provoke some discussion about the related behaviors
> here and see if anyone has any ideas about a different way to approach
> things. One of the main things that feels odd to me is that I am
> regenerating the entire contents of these slots on each hover/leave
> event, which just seems conceptually a little wacky. It actually works
> out OK in terms of performance, so all in all I'm just glad to have
> figured something workable out.
>
> --
> Seth Thomas Rasmussen
> http://greatseth.com
>

Reply via email to