Text Operations

   

Practical Programming in Tcl & Tk, Third Edition
By Brent B. Welch

Table of Contents
Chapter 33.  The Text Widget


Table 33-9 describes the text widget operations, including some that are not discussed in this chapter. In the table, $t is a text widget:

Table 33-9. Operations for the text widget.
$t bbox indexReturns the bounding box of the character at index. Four numbers are returned: x y width height.
$t cget optionReturns the value of the configuration option.
$t compare i1 op i2Performs index comparison. i1 and i2 are indexes. op is one of < <= == >= > !=
$t configure ...Queries or sets configuration options.
$t debug booleanEnables consistency checking for B-tree code.
$t delete i1 ?i2?Deletes from i1 up to, but not including i2. Just deletes the character at i1 if i2 is not specified.
$t dlineinfo indexReturns the bounding box, in pixels, of the display for the line containing index. Five numbers are returned: x y width height baseline.
$t dump ?options? i1 ?i2?Returns the marks, tags, windows, images, and text contained in the widget. Options are -all, -command command, -image, -mark, -tag, -text, and -window.
$t get i1 ?i2?Returns the text from i1 to i2, or just the character at i1 if i2 is not specified.
$t image cget optionReturns the value of the image option.
$t image configure ?options?Queries or sets the configuration of an embedded image.
$t image create option value ...Creates an embedded image. Options are described in Table 33-7 on page 467.
$t image namesReturns the names of all embedded images.
$t index indexReturns the numerical value of index.
$t insert index chars ?tags? ?chars tags? ...Inserts chars at the specified index. If tags are specified, they are added to the new characters.
$t mark gravity name ?direction?Queries or assigns a gravity direction to the mark name. direction, if specified, is left or right.
$t mark namesReturns a list of defined marks.
$t mark next indexReturns the mark after index.
$t mark previous indexReturns the mark before index.
$t mark set name indexDefines a mark name at the given index.
$t mark unset name1 ?name2 ...?Deletes the named mark, or marks.
$t scan mark x yAnchors a scrolling operation.
$t scan dragto x yScrolls based on a new position.
$t search ?switches? pattern index ?stopIndex?Searches for pattern starting at index. The index of the start of the match is returned. Switches are described in Table 33-4 on page 464.
$t see indexPositions the display to view index.
$t tag add name i1 ?i2? ?i1 i2? ?i1 i2? ...Adds the tag to i1 through, but not including i2, or just the character at i1 if i2 is not given.
$t tag bind name ?sequence? ?script?Queries or defines bindings for the tag name.
$t tag configure name ...Sets or queries the configuration of tag name.
$t tag cget name optionReturns the value of option for tag name.
$t tag delete tag1 ?tag2 ...?Deletes information for the named tags.
$t tag lower tag ?below?Lowers the priority of tag to the lowest priority or to just below tag below.
$t tag names ?index?Returns the names of the tags at the specified index, or in the whole widget, sorted from lowest to highest priority.
$t tag nextrange tag i1 ?i2?Returns a list of two indices that are the next range of text with tag that starts at or after i1 and before index i2, or the end.
$t tag prevrange tag i1 ?i2?Returns a list of two indices that are the previous range of text with tag that ends at or before i1 and at or after index i2, or 1.0.
$t tag raise tag ?above?Raises the priority of tag to the highest priority, or to just above the priority of tag above.
$t tag ranges tagReturns a list describing all the ranges of tag.
$t tag remove tag i1 ?i2? ?i1 i2? ?i1 i2? ...Removes tag from the range i1 up to, but not including i2, or just at i1 if i2 is not specified.
$t window config win ...Queries or modifies the configuration of the embedded window. win is a Tk pathname or an index.
$t window cget win optionReturns the value of option for win.
$t window create ix argsCreates an embedded window at ix.
$t window namesReturns a list of windows embedded in $t.
$t xviewReturns two fractions between zero and one that describe the amount of text off-screen to the left and the amount of text displayed.
$t xview moveto fractionPositions the text so fraction of the text is off screen to the left.
$t xview scroll num whatScrolls num of what, which is units or pages.
$t yviewReturns two fractions between zero and one that describe the amount of text off-screen toward the beginning and the amount of text displayed.
$t yview moveto fractionPositions the text so fraction of the text is off-screen toward the beginning.
$t yview scroll num whatScrolls num of what, which is units or pages.
$t yview ?-pickplace? ixObsolete. Use the see operation, which is similar.
$t yview numObsolete. Position line num at the top of screen.


       
    Top
     



    Practical Programming in Tcl and Tk
    Practical Programming in Tcl and Tk (4th Edition)
    ISBN: 0130385603
    EAN: 2147483647
    Year: 1999
    Pages: 478

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net