Hello,
I’m still learning tk with Ruby and doing my way through the different
tk ‘external’ packages…
in tkextlib\tcllib there is the “tablelist” package that I found
interesting and will try to use in my next personal work/learning
program.
the ruby interface files seems to be for an older version than what is
available here : http://www.nemethi.de/
so it seems that this ‘tablelist’ version is now an autonomous package
that I had to download separately, but I think that if I want to use all
this version possibilities, I will need some updated ruby tablelist
interface files…?
(of course I could use the ‘standard/old’ version included in tk for
now, but I also want to learn what I could do in case I want to use a
specific tcl package)
is there informations somewhere that could help me to update those files
myself and learn how I can use tcl programs in Ruby, or is there a place
to post a request for updated files, or what else…?
an example of minimum definition of a wrapper class is
class MyFooWidget < TkWindow
TkCommandNames = [‘tk::foowidget’.freeze].freeze
WidgetClassName = ‘FooWidget’.freeze
WidgetClassNames[WidgetClassName] ||= self
end
I forgot “package require”.
Most of tcl extensions need call ‘package’ command to make them
available.
On Ruby/Tk, please call “TkPackage.require(packagename)” to do that.
in tkextlib\tcllib there is the “tablelist” package that I found
interesting and will try to use in my next personal work/learning
program.
the ruby interface files seems to be for an older version than what is
available here : http://www.nemethi.de/
I think that there is no relation between it and tcllib(tklib) version
of ‘tablelist’.
You have to control tcl interpreter directly (by Tk.tk_call method,
and so on), or write your own wrapper library.
For example, when you want to use a widget object which is created by
‘::tk::foowidget’ tcl command and whose tcl classname is ‘FooWidget’,
an example of minimum definition of a wrapper class is
class MyFooWidget < TkWindow
TkCommandNames = [‘tk::foowidget’.freeze].freeze
WidgetClassName = ‘FooWidget’.freeze
WidgetClassNames[WidgetClassName] ||= self
end
Then, you can use a MyFooWdiget widget object with Ruby/Tk’s standard
methods for widget objects (e.g. ‘foo_widget = MyFooWidget.new(…){ …
}’,
‘foo_widget.pack(…)’, ‘foo_widget.foo_optkey = …’, and so on).
Of course, the wrapper has no special methods for the widget class.
So, when you want to use a a subcommand of the widget “bar opt …”,
for example, you must call ‘foo_widget.tk_send(“bar”, opt, …)’.
Please check library files under “/tkextlib”.
Those are examples of how to write wrapper libraries.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.