| package require Tksgml | |
| 1.2 |
The package require command returns the version number of the loaded library. The exact result depends on the installed version of TkSGML.
Normally, you will not have to deal with the details of the package naming scheme unless you have more than one version of TkSGML installed. In this case, you may want to use the exact package name to make sure that the correct TkSGML version is used. For example, to load TkSGML 1.2, you could use the command
| package require -exact Tksgml 1.2 |
Please consult chapter
of this manual if the package
system fails to load the sgml extension.
| load ./libtksgml.so.1.2 |
| load ./tksgml.dll |
When the TkSGML package is loaded into an Tcl interpreter, the activation key for TkSGML is tested and a number of initialization steps are performed.
An activation key contains a serial number that identifies the activation key itself and a version number that specifies the major version of TkSGML that can be activated by this key. For time-restricted licenses such as demo licenses, the activation key contains an expiration date that specifies when the key ceases to be valid.
After the license key has been loaded, some fields in the global Tcl array TkSGML are filled with information from the license key file. These fields are described below:
) for the sgml widget. It does this by
searching for a file with the name tksgml.tcl in the following
places:
Software\\Epc\\TkSGML\\m.n.
auto_path.
| Variable Name | Step |
| TkSGML(major_version) | ![]() |
| TkSGML(minor_version) | ![]() |
| TkSGML(version) | ![]() |
| TkSGML_library | ![]() |
| TkSGML(keyfile) | ![]() |
| TkSGML(license) | ![]() |
| TkSGML(licensee) | ![]() |
| TkSGML(expires) | ![]() |
| TkSGML(key_major_version) | ![]() |
After loading the shared library into the Tcl interpreter, a new Tcl command pcrmsgml is created in this interpreter. The pcrmsgml command can then be used to creat any number of sgml widgets in this interpreter.
| sgml name ?specs? | |
| creates a new window name and makes it into an sgml widget. Optionally configures the window with the configuration options in specs. | |
To use the sgml widget inside a Tk application, it is necessary to create a widget. Like any other Tk widget, an sgml widget is created by invoking a command named after the widget's class. For sgml widget, the command name is simply sgml. The pcrmsgml command has the following general form:
The only required parameter for the sgml command is the pathname for the new widget in the widget hierarchy. The widget must not already exist, but it's parent must exist. The sgml command will create the widget and its corresponding window. For example, the following command will create the sgml widget .s as a child of the applications main window '.':
| sgml .s | |
| .s |
The widget name is followed by any number of pairs of arguments, where
the first argument for the widget specifies the name of a
configuration option for the widget. The sgml widget supports
most of the configuration options for the Tk text widget and some
additional options that are specific for the sgml widget. See
chapter
for details on the configuration options.
Like any other Tk widget, the sgml widget must be managed by a geometry manager to become visible on the screen. When the packer is used, the following command would pack the sgml widget we have just created inside the main window of the Tk application:
| pack .s |
The Tk documentation describes the geometry managers in detail. For more specific information on the packer, consult the manual page for the pack command, normally pack(n).
Whenever a new sgml widget has been created, a new Tcl command is created whose name is identical to the widget's name. This command is called the widget command for the sgml widget. After the sgml widget .s has been created, a command .s appeared in the applications Tcl interpreter. This command exists as long as the sgml widget exists; if the widget is deleted, then the command will disappear from the Tcl interpreter.
The widget command is used to communicate with the existing sgml widget. Like in any other widget command, the command name is the name of the widget and the first argument specifies an operation to invoke on the widget. Here are some examples of widget commands that can be invoked for the sgml widget .s:
| .s configure -foreground blue | |
| .s insert 4.3 "A string" |
The sgml widget supports most of the commands of the Tk text widget
and a number of additional commands that are specific to sgml
widgets. A detailed description of the supported configuration options
can be found in section
.