set_msg(x, y, bhelp, parent)
Instance Public methods
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | # CASE1 : command takes no arguemnt bh = Tk::RbWidget::BalloonHelp. new (sb, :interval => 500 , :relief => :ridge , :background => 'white' , :command =>proc{ y = TkWinfo.pointery(sb) - TkWinfo.rooty(sb) bh.text "current index == #{sb.nearest(y)}" }) # CASE2 : command takes 2 arguemnts bh = Tk::RbWidget::BalloonHelp. new (sb, :interval => 500 , :relief => :ridge , :background => 'white' , :command =>proc{|x, y| bh.text "current index == #{sb.nearest(y)}" }) # CASE3 : command takes 3 arguemnts Tk::RbWidget::BalloonHelp. new (sb, :interval => 500 , :relief => :ridge , :background => 'white' , :command =>proc{|x, y, bhelp| bhelp.text "current index == #{sb.nearest(y)}" }) # CASE4a : command is a Proc object and takes 4 arguemnts cmd = proc{|x, y, bhelp, parent| bhelp.text "current index == #{parent.nearest(y)}" } Tk::RbWidget::BalloonHelp. new (sb, :interval => 500 , :relief => :ridge , :background => 'white' , :command =>cmd) sb2 = TkScrollbox. new .pack( :fill => :x ) sb2.insert( :end , *%w( AAA BBB CCC DDD EEE FFF GGG HHH III JJJ KKK LLL MMM )) Tk::RbWidget::BalloonHelp. new (sb2, :interval => 500 , :padx => 5 , :relief => :raised , :background => 'gray25' , :foreground => 'white' , :command =>cmd) |
#=begin # CASE4b : command is a Method object and takes 4 arguemnts
Please login to continue.