Tk::Reindex3pm
Change the base index of text-like widgets
Usage
use Tk::ReindexedText;$t1=$w->ReindexedText(-linestart => 2);use Tk::ReindexedROText;$t2=$w->ReindexedROText(-linestart => 0);
Overview
Creates a new widget class based on Text-like widgets that can redefine the line number base (normally Text widgets start line numbers at 1), or possibly other manipulations on indexes.
Options
The newly-defined widget takes all the same options as the base widget, which defaults to Text.
Options
- Name:
lineStart
- Class:
LineStart
- Switch:
-linestart -
Sets the line number of the first line in the
Textwidget. The default-toindexcmdand-fromindexcmduse this configuration option.-item Name:
toIndexCmdfromIndexCmd-item Class:
ToIndexCmdFromIndexCmd-item Switch:
-toindexcmd-fromindexcmdThese two options specify callbacks that are called with a list of indexes and are responsible for translating them to/from indexes that the base
Textwidget can understand. The callback is passed the widget followed by a list of indexes, and should return a list of translated indexes.-toindexcmdshould translate from 'user' indexes to 'native'Text-compatible indexes, and-fromindexcmdshould translate from 'native' indexes to 'user' indexes.The default callbacks simply add/subtract the offset given by the
-linestartoption for all indexes in 'line.character' format.It would probably be prudent to make these functions inverses of each other.
Class methods
- import
-
To make new Reindex widgets, this function should be called via
usewith the name of the Text-like base class that you are extending with "Reindex" capability. 'use base(Tk::Reindex Tk::nameofbasewidget)' should also be specified for that widget.
Releases
13 releases since Debian 3.0 (Woody); the text changed 12 times.