.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Reindex 3" .TH Reindex 3 2023-07-25 Tk1.1 "perl/Tk Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Tk::Reindex \- change the base index of Text\-like widgets .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& use Tk::ReindexedText; \& $t1=$w\->ReindexedText(\-linestart => 2); \& \& use Tk::ReindexedROText; \& $t2=$w\->ReindexedROText(\-linestart => 0); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Creates a new widget class based on \fBText\fR\-like widgets that can redefine the line number base (normally \fBText\fR widgets start line numbers at 1), or possibly other manipulations on indexes. .SH "STANDARD OPTIONS" .IX Header "STANDARD OPTIONS" The newly-defined widget takes all the same options as the base widget, which defaults to \fBText\fR. .SH "WIDGET-SPECIFIC OPTIONS" .IX Header "WIDGET-SPECIFIC OPTIONS" .IP "Name: \fBlineStart\fR" 4 .IX Item "Name: lineStart" .PD 0 .IP "Class: \fBLineStart\fR" 4 .IX Item "Class: LineStart" .IP "Switch: \fB\-linestart\fR" 4 .IX Item "Switch: -linestart" .PD Sets the line number of the first line in the \fBText\fR widget. The default \fB\-toindexcmd\fR and \fB\-fromindexcmd\fR use this configuration option. .Sp \&\-item Name: \fBtoIndexCmd\fR \fBfromIndexCmd\fR .Sp \&\-item Class: \fBToIndexCmd\fR \fBFromIndexCmd\fR .Sp \&\-item Switch: \fB\-toindexcmd\fR \fB\-fromindexcmd\fR .Sp These two options specify callbacks that are called with a list of indexes and are responsible for translating them to/from indexes that the base \fBText\fR widget can understand. The callback is passed the widget followed by a list of indexes, and should return a list of translated indexes. \fB\-toindexcmd\fR should translate from 'user' indexes to 'native' \fBText\fR\-compatible indexes, and \fB\-fromindexcmd\fR should translate from 'native' indexes to 'user' indexes. .Sp The default callbacks simply add/subtract the offset given by the \&\fB\-linestart\fR option for all indexes in 'line.character' format. .Sp It would probably be prudent to make these functions inverses of each other. .SH "CLASS METHODS" .IX Header "CLASS METHODS" .IP import 4 .IX Item "import" To make new Reindex widgets, this function should be called via \fBuse\fR with 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. .SH BUGS .IX Header "BUGS" I've used the word "indexes" instead of "indices" throughout the documentation. .PP All the built-in perl code for widget bindings & methods will use the new 'user' indexes. Which means all this index manipulation might might break code that is trying to parse/manipulate indexes. Or even assume that '1.0' is the beginning index. \fBTk::Text::Contents\fR comes to mind. .SH AUTHOR .IX Header "AUTHOR" Andrew Allen .PP This code may be distributed under the same conditions as Perl.