-show string If this option is specified, then the true contents of the entry are not displayed in the window. Instead, each character in the entry's value will be displayed as the first character in the value of this option, such as ``*''. This is useful, for example, if the entry is to be used to enter a password.
-state state Specifies one of two states for the entry: \f5normal or \f5disabled. If the entry is disabled then the value may not be changed using widget commands and no insertion cursor will be displayed, even if the input focus is in the widget.
-width dist Specifies an integer value indicating the desired width of the entry window.
An entry is a widget that displays a one-line text string and allows that string to be edited using widget commands described below, which are typically bound to keystrokes and mouse actions. When first created, an entry's string is empty. A portion of the entry may be selected as described below. Entries observe the standard Tk rules for dealing with the input focus. When an entry has the input focus it displays an insertion cursor to indicate where new characters will be inserted.
Entries are capable of displaying strings that are too long to fit entirely within the widget's window. In this case, only a portion of the string will be displayed; commands described below may be used to change the view in the window. Entries use the standard \f5xscrollcommand mechanism for interacting with scrollbars (see the description of the \f5xscrollcommand option for details).
.EX pathName option ?arg arg ...?
Many of the widget commands for entries take one or more indices as arguments. An index specifies a particular character in the entry's string, in any of the following ways:
12 number Specifies the character as a numerical index, where 0 corresponds to the first character in the string.
12 \f5anchor Indicates the anchor point for the selection, which is set with the \f5select from and \f5select adjust widget commands.
12 \f5end Indicates the character just after the last one in the entry's string. This is equivalent to specifying a numerical index equal to the length of the entry's string.
12 \f5insert Indicates the character adjacent to and immediately following the insertion cursor.
12 \f5sel.first Indicates the first character in the selection. It is an error to use this form if the selection isn't in the entry window.
12 \f5sel.last Indicates the character just after the last one in the selection. It is an error to use this form if the selection isn't in the entry window.
12 \f5@number In this form, number is treated as an x-coordinate in the entry's window; the character spanning that x-coordinate is used. For example, ``\f5@0'' indicates the left-most character in the window.
The following commands are possible for entry widgets:
pathName \f5bbox index Returns a list of four numbers describing the bounding box of the character given by index. The first two elements of the list give the x and y coordinates of the upper-left corner of the screen area covered by the character (in pixels relative to the widget) and the last two elements give the width and height of the character, in pixels. The bounding box may refer to a region outside the visible area of the window.
pathName \f5cget option Returns the current value of the configuration option given by option. Option may have any of the values accepted by the \f5entry command.
pathName \f5configure ?option? ?value option value ...? Query or modify the configuration options of the widget. If no option is specified, returns a list of all of the available options for pathName. If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. Option may have any of the values accepted by the \f5entry command.
pathName \f5delete first ?last? Delete one or more elements of the entry. First is the index of the first character to delete, and last is the index of the character just after the last one to delete. If last isn't specified it defaults to first+1, i.e. a single character is deleted. This command returns an empty string.
pathName \f5get Returns the entry's string.
pathName \f5icursor index Arrange for the insertion cursor to be displayed just before the character given by index. Returns an empty string.
pathName \f5index index Returns the numerical index corresponding to index.
pathName \f5insert index string Insert the characters of string just before the character indicated by index. Returns an empty string.
pathName \f5see index Adjusts the view in the window so that the character given by index is completely visible.
pathName \f5selection option arg This command is used to adjust the selection within an entry. It has several forms, depending on option:
pathName \f5selection adjust index Locate the end of the selection nearest to the character given by index, and adjust that end of the selection to be at index (i.e including but not going beyond index). The other end of the selection is made the anchor point for future \f5select to commands. If the selection isn't currently in the entry, then a new selection is created to include the characters between index and the most recent selection anchor point, inclusive. Returns an empty string.
pathName \f5selection clear Clear the selection if it is currently in this widget. If the selection isn't in this widget then the command has no effect. Returns an empty string.
pathName \f5selection from index Set the selection anchor point to just before the character given by index. Doesn't change the selection. Returns an empty string.
pathName \f5selection present Returns 1 if there are characters selected in the entry, 0 if nothing is selected.
pathName \f5selection range start end Sets the selection to include the characters starting with the one indexed by start and ending with the one just before end. If end refers to the same character as start or an earlier one, then the entry's selection is cleared.
pathName \f5selection to index If index is before the anchor point, set the selection to the characters from index up to but not including the anchor point. If index is the same as the anchor point, do nothing. If index is after the anchor point, set the selection to the characters from the anchor point up to but not including index. The anchor point is determined by the most recent \f5select from or \f5select adjust command in this widget. If the selection isn't in this widget then a new selection is created using the most recent anchor point specified for the widget. Returns an empty string.
pathName \f5xview args This command is used to query and change the horizontal position of the text in the widget's window. It can take any of the following forms:
pathName \f5xview Returns a list containing two elements. Each element is a real fraction between 0 and 1; together they describe the horizontal span that is visible in the window. For example, if the first element is .2 and the second element is .6, 20% of the entry's text is off-screen to the left, the middle 40% is visible in the window, and 40% of the text is off-screen to the right. These are the same values passed to scrollbars via the \f5-xscrollcommand option.
pathName \f5xview index Adjusts the view in the window so that the character given by index is displayed at the left edge of the window.
pathName \f5xview moveto fraction Adjusts the view in the window so that the character fraction of the way through the text appears at the left edge of the window. Fraction must be a fraction between 0 and 1.
pathName \f5xview scroll number what This command shifts the view in the window left or right according to number and what. Number must be an integer. What must be either \f5units or \f5pages. If what is \f5units, the view adjusts left or right by number average-width characters on the display; if it is \f5pages then the view adjusts by number screenfuls. If number is negative then characters farther to the left become visible; if it is positive then characters farther to the right become visible.
If the entry is disabled using the \f5-state option, then the entry's view can still be adjusted and text in the entry can still be selected, but no insertion cursor will be displayed and no text modifications will take place.
The behaviour of entries can be changed by defining new bindings for individual widgets.