Shoes tooltips?
I'm using the shoes GUI toolkit, and I'd like to have a tooltip show up when the user rolls over a button.
Is there a way to do that in Shoes? Or do I need to file a bug/feature request 开发者_JAVA百科in Shoes itself?
Here a solution for red shoes
Shoes.app do
s = stack :width => 400, :height => 400 do
@tip = flow :height => 20 do
para ""
end
@r = flow :width => 60, :height => 20 do
background red
para "button"
click do
alert("You clicked me !!")
end
hover do
@tip.clear()
@tip.para "this is the tip"
end
leave do
@tip.clear(background white)
@tip.para ""
end
end
end
end
Try looking at this part of shoes-contrib: https://github.com/shoes/shoes-contrib/blob/master/events/background-hover.rb
in windows that won't work with red shoes since alle events are stealed by windows. You can get this to work if you don't use a native controll, eg a shape instead of a button. You could also use green shoes instead of red shoes. Cheers
精彩评论