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 317 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
_call(arg): invoke callback
arg: callback parameter
# File tk/lib/tcltk.rb, line 343 def _call(arg) @pr.call(arg) end
#to_eval(): returns string representation for @ip._eval_args
# File tk/lib/tcltk.rb, line 330 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
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.