Hi,
does anyone know how to use tcltk-ext. I want to use the mclistbox extension for tcl but am unable to understand the japanese documentation. I have tcltk-ext installed but I am haveing problems useing it for this extension.
Cheers
Nigel
Hi,
does anyone know how to use tcltk-ext. I want to use the mclistbox extension for tcl but am unable to understand the japanese documentation. I have tcltk-ext installed but I am haveing problems useing it for this extension.
Cheers
Nigel
Hi,
From: Nigel Wilkinson nigel.w@berlin.de
Subject: tcltk-ext help, I can’t read japanese
Date: Mon, 21 Oct 2002 00:46:39 +0900
Message-ID: 20021020164413.684d1839.nigel.w@berlin.de
does anyone know how to use tcltk-ext. I want to use the mclistbox
extension for tcl but am unable to understand the japanese documentation.
I have tcltk-ext installed but I am haveing problems useing it for this
extension.
Here is an English document which was witten by a tcltk-ext user.
He couldn’t understand the [ -b base_info [-g] ] option.
But if your extension can be loaded dynamically,
you don’t need the option.
==========================================
tcltk-ext is a Ruby code wrapper generator for Tcl/Tk extensions.
To install tcltk-ext, you must copy
tcltkextlib.rb, tcltkext.rb, and tkext.rb to Ruby’s library path,
e.g., to lib/ruby/site-ruby/1.6/
Files with names starting with ‘test’ are sample scripts that exercise
these library files.
mk_tkextlib.rb is the actual wrapper generator.
Two generated wrapper files are included:
mk_tkextlib.rb [-v] [-b base_info [-g]] [-p pkg_name]
-v verbose flag
-b base_info -g ???
-p pkg_name the name of the Tcl/Tk extension package
The generator
The pkg_name.def file defines two arrays,
$pre_load_lib and $ext_lib_info.
Entries for both arrays have the same format, namely arrays specifying
mk_tkextlib.rb will load the entries in $pre_load_lib
prior to the entries in $ext_lib. Wrapper code will be generated
only for $ext_lib commands.
We assume the directory and file structure of the Tcl/Tk installation to be
Tcl
. bin
. . wish83 (executable)
. . . tix818311.dll (Tix dynamic link library)
. . . itk32.dll (Itk dynamic link library)
. lib
. . tcl8.3
. . tk8.3
. . itcl3.2
. . itk3.2
. . tix8.1
. . . pkgIndex.tcl (Tix package initialization file)
The following Tix.def file
$pre_load_lib = [
[‘Itk’, ‘/Tcl/bin/itk32.dll’, [‘/Tcl/lib/itk3.2’]],
nil
]
$ext_lib_info = [
[‘Tix’, ‘/Tcl/bin/tix818311.dll’, [‘/Tcl/lib/tix8.1’]],
nil
]
will cause the wrapper generator to preload the Itk extension,
then load the Tix extension and produce a ruby wrapper for Tix.
The resulting files Tix.rb and Tix.inf should be placed in the
Ruby library path.
The command required to produce these files is
mk_tkextlib.rb -p Tix
If your Tcl/Tk can do dynamic-loading,
probably you don’t need -b option.
To use the provided wrappers for Tix and Blt, please make sure
that the versions of your library agree with the versions
specified in the .def files.
If they agree, modify the paths in Tix.inf and Blt.inf
to reflect your intallation, and copy Tix.inf, Tix.rb,
Blt.inf and Blt.rb to your Ruby library path.
For other Tcl/Tk extensions, you should only need to write
a corresponding .def file and run mk_tkextlib.rb.
require ‘Tix’
TkOption.add(‘TixControlentry.width’, 10)
TkOption.add(‘TixControllabel.width’, 18)
TkOption.add(‘TixControllabel.anchor’, ‘e’)
TkRoot.new.background ‘gray’
nb = TixNoteBook.new(nil, ‘ipadx’=>6, ‘ipady’=>6)
nb.subwidget(‘nbframe’, ‘configure’, ‘backpagecolor’=>‘gray’)
nb.add(‘hard_disk’, ‘label’=>‘Hard Disk’, ‘underline’=>0)
nb.add(‘network’, ‘label’=>‘Network’, ‘underline’=>0)
nb.pack(‘expand’=>true, ‘fill’=>‘both’, ‘padx’=>5, ‘pady’=>5, ‘side’=>‘top’)
sw = nb.subwidget(‘hard_disk’)
f_nb = TkFrame.new(nb).pack(‘side’=>‘left’, ‘padx’=>2, ‘pady’=>2,
‘fill’=>‘both’, ‘expand’=>true, ‘in’=>sw)
a = TixControl.new(f_nb, ‘value’=>12, ‘label’=>'Access Time: ')
w = TixControl.new(f_nb, ‘value’=>400, ‘label’=>'Write Throughput: ')
r = TixControl.new(f_nb, ‘value’=>400, ‘label’=>'Read Throughput: ')
c = TixControl.new(f_nb, ‘value’=>1021, ‘label’=>'Capacity: ')
Tk.pack(a, w, r, c, ‘side’=>‘top’, ‘padx’=>20, ‘pady’=>2)
f_common = TkFrame.new(nb).pack(‘side’=>‘right’, ‘padx’=>2, ‘pady’=>2,
‘fill’=>‘y’, ‘in’=>sw)
TkButton.new(f_common, ‘text’=>‘OK’, ‘width’=>6,
‘command’=>‘exit’).pack(‘side’=>‘top’, ‘padx’=>2, ‘pady’=>2)
TkButton.new(f_common, ‘text’=>‘Cancel’, ‘width’=>6,
‘command’=>‘exit’).pack(‘side’=>‘top’, ‘padx’=>2, ‘pady’=>2)
sw = nb.subwidget(‘network’)
f_nb = TkFrame.new(nb).pack(‘side’=>‘left’, ‘padx’=>2, ‘pady’=>2,
‘fill’=>‘both’, ‘expand’=>true, ‘in’=>sw)
a = TixControl.new(f_nb, ‘value’=>12, ‘label’=>'Access Time: ')
w = TixControl.new(f_nb, ‘value’=>400, ‘label’=>'Write Throughput: ')
r = TixControl.new(f_nb, ‘value’=>400, ‘label’=>'Read Throughput: ')
c = TixControl.new(f_nb, ‘value’=>1021, ‘label’=>'Capacity: ')
u = TixControl.new(f_nb, ‘value’=>10, ‘label’=>'Users: ')
Tk.pack(a, w, r, c, ‘side’=>‘top’, ‘padx’=>20, ‘pady’=>2)
f_common = TkFrame.new(nb).pack(‘side’=>‘right’, ‘padx’=>2, ‘pady’=>2,
‘fill’=>‘y’, ‘in’=>sw)
TkButton.new(f_common, ‘text’=>‘OK’, ‘width’=>6,
‘command’=>‘exit’).pack(‘side’=>‘top’, ‘padx’=>2, ‘pady’=>2)
TkButton.new(f_common, ‘text’=>‘Cancel’, ‘width’=>6,
‘command’=>‘exit’).pack(‘side’=>‘top’, ‘padx’=>2, ‘pady’=>2)
Tk.mainloop
=========================================
require ‘tkext’
module Tix
extend Tix
#require ‘tkext’
require ‘tk’
module Tix
extend Tix
–
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)