George Peter Staplin's ctext package is a library extension for Tcl/Tk versions 8.0 or higher, written in pure Tcl/Tk code. It is part of tklib, which has the address
Tablelist supports interactive cell editing with the aid of the ctext widget implemented in the package mentioned above. The steps needed for using this widget for editing the cells of a given column are as follows:
tablelist::addCtextcommand described below.
columnconfiguresubcommand to set the given column's
-editableoption to true and its
-editwindowoption to the value returned by the command mentioned above. (These options are supported at cell level, too, with the aid of the
tablelist::addCtext– Register the ctext widget for interactive cell editing
-editwindowcolumn or cell configuration option. It may be any string that is different from the Tk core and tile edit window names. The default is
ctext. The command returns its
-padyoptions set to
-wrapoption set to
none, and its initial height set to the number of lines contained in it. There is, however, an exception from this rule: If the
-wrapoption of the cell's column was set to true and Tk version 8.5 or higher is being used, then the ctext widget's
-wrapoption will be set to
wordand its initial height will equal the number of display lines (taking into account the line wraps) contained in it. You can use the script corresponding to the
-editstartcommandtablelist configuration option to override the initial settings (except the height) according to your needs.
-wrapoption was set to
char(either by Tablelist or from within the above-mentioned script) and Tk version 8.5 or higher is being used, then, whenever its width changes (e.g., due to interactive column resizing), its height will be set automatically to the number of display lines contained in it. (The number of display lines is retrieved with the aid of the
count -displaylinestext widget subcommand, introduced in Tk 8.5.)
package require Wcbor
package require wcb) then the ctext widget's height will be updated automatically whenever text is inserted into or deleted from it, which makes the editing much more user-friendly. This is achieved by using an appropriately defined after-
deletecallback for the edit window. You can use the script corresponding to the
-editstartcommandtablelist configuration option to define further callbacks for the ctext widget. (The above-mentioned callback is created via
wcb::cbappend, after returning from that script.)
Tabkey is reserved for navigation between the editable cells, but the user can insert a tabulator character into the ctext widget by pressing
KP_Enterkeys insert a newline character into the ctext widget.
Control-jcan also be used for inserting a newline.
Control-KP_Enterterminate the editing and destroy the edit window.
Control-Endhave their well-known text widget-specific bindings, just like
tk_strictMotifis false. Again, this is different from the behavior of the other widgets used for interactive cell editing (except the Tk core text widget). For jumping into the first/last editable cell, the user can press
Command-Endon Mac OS Classic and Mac OS X Aqua).