| Class | TclTkCallback |
| In: |
tk/lib/tcltk.rb
|
| Parent: | TclTkObject |
class TclTkCallback: tcl/tk callbacks
initialize(interp, pr, arg):
interp: interpreter(TclTkInterpreter)
pr: callback procedure(Proc)
arg: string to pass as block parameters of pr
bind command of tcl/tk uses % replacement for parameters
pr can receive replaced data using block parameter
its format is specified by arg string
You should not specify arg for the command like
scrollbar with -command option, which receives parameters
without specifying any replacement
# File tk/lib/tcltk.rb, line 316 def initialize(interp, pr, arg = nil) # auto-generate tcl/tk representation (variable name) exp = TclTk._newname("c_") # initialize TclTkObject super(interp._tcltkip(), exp) # save parameters @pr = pr @arg = arg # register in the module TclTk._addcallback(self) end
to_eval(): retuens string representation for @ip._eval_args
# File tk/lib/tcltk.rb, line 329 def to_eval() if @arg # bind replaces %s before calling ruby_fmt, so %%s is used s = %Q/{ruby_fmt {TclTk._callcallback("#{to_s()}", "%%s")} #{@arg}}/ else s = %Q/{ruby_fmt {TclTk._callcallback("#{to_s()}", "%s")}}/ end return s end
ruby-doc.org is hosted and run by James Britt and Happy Camper Studios, a Ruby application development company in Phoenix, Arizona. Ruby-doc.org was created in 2002 to promote the Ruby language and to help other Ruby hackers.
Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.
For more information on the Ruby programming language, visit ruby-lang.org.
Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.