1mNAME0m
       entry - Create and manipulate entry widgets

1mSYNOPSIS0m
       1mentry 4m22mpathName24m ?4moptions24m?

1mSTANDARD OPTIONS0m
       1m-background           -highlightbackground -insertontime-selectforeground0m
       1m-borderwidth          -highlightcolor      -insertwidth-takefocus0m
       1m-cursor               -highlightthickness  -justify-textvariable0m
       1m-exportselection      -insertbackground    -relief-xscrollcommand0m
       1m-font                 -insertborderwidth   -selectbackground0m
       1m-foreground           -insertofftime       -selectborderwidth0m

       See the 1moptions 22mmanual entry for details on the standard options.

1mWIDGET-SPECIFIC OPTIONS0m
       Command-Line Name:1m-invalidcommand or -invcmd0m
       Database Name:  1minvalidCommand0m
       Database Class: 1mInvalidCommand0m

              Specifies a script to eval when 1mvalidateCommand 22mreturns 0.  Set-
              ting it to {} disables this feature (the default).  The best use
              of  this  option is to set it to 4mbell24m.  See 1mValidation 22mbelow for
              more information.

       Command-Line Name:1m-show0m
       Database Name:  1mshow0m
       Database Class: 1mShow0m

              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 exam-
              ple, if the entry is to be used to enter a password.  If charac-
              ters  in the entry are selected and copied elsewhere, the infor-
              mation copied will be what is displayed, not the  true  contents
              of the entry.

       Command-Line Name:1m-state0m
       Database Name:  1mstate0m
       Database Class: 1mState0m

              Specifies  one of two states for the entry:  1mnormal 22mor 1mdisabled22m.
              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.

       Command-Line Name:1m-validate0m
       Database Name:  1mvalidate0m
       Database Class: 1mValidate0m

              Specifies the mode in which  validation  should  operate:  1mnone22m,
              1mfocus22m,  1mfocusin22m,  1mfocusout22m,  1mkey22m,  or 1mall22m.  It defaults to 1mnone22m.
              When you want validation, you must explicitly state  which  mode
              you wish to use.  See 1mValidation 22mbelow for more.

       Command-Line Name:1m-validatecommand or -vcmd0m
       Database Name:  1mvalidateCommand0m
       Database Class: 1mValidateCommand0m

              Specifies  a  script to eval when you want to validate the input
              into the entry widget.  Setting it to {} disables  this  feature
              (the  default).   This  command  must return a valid tcl boolean
              value.  If it returns 0 (or the valid  tcl  boolean  equivalent)
              then  it  means you reject the new edition and it will not occur
              and the 1minvalidCommand 22mwill be evaluated if it  is  set.  If  it
              returns  1,  then  the new edition occurs.  See 1mValidation 22mbelow
              for more information.

       Command-Line Name:1m-width0m
       Database Name:  1mwidth0m
       Database Class: 1mWidth0m

              Specifies an integer value indicating the desired width  of  the
              entry  window,  in average-size characters of the widget's font.
              If the value is less than or equal to zero, the widget  picks  a
              size just large enough to hold its current text.


1mDESCRIPTION0m
       The 1mentry 22mcommand creates a new window (given by the 4mpathName24m argument)
       and makes it into  an  entry  widget.   Additional  options,  described
       above,  may  be specified on the command line or in the option database
       to configure aspects of the entry such as its colors, font, and relief.
       The 1mentry 22mcommand returns its 4mpathName24m argument.  At the time this com-
       mand is invoked, there must not exist  a  window  named  4mpathName24m,  but
       4mpathName24m's parent must exist.

       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 cre-
       ated, an entry's string is empty.   A  portion  of  the  entry  may  be
       selected  as  described  below.  If an entry is exporting its selection
       (see the 1mexportSelection 22moption), then it will observe the standard X11
       protocols  for  handling the selection;  entry selections are available
       as type 1mSTRING22m.  Entries also observe the standard Tk rules for dealing
       with the input focus.  When an entry has the input focus it displays an
       4minsertion24m 4mcursor24m 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 1mxScrollCommand0m
       mechanism for interacting with scrollbars (see the description  of  the
       1mxScrollCommand  22moption  for  details).   They also support scanning, as
       described below.


1mVALIDATION0m
       Validation works by setting the  1mvalidateCommand  22moption  to  a  script
       which will be evaluated according to the 1mvalidate 22moption as follows:


       1mnone      22mDefault.  This means no validation will occur.

       1mfocus     validateCommand  22mwill  be  called  when the entry receives or
                 loses focus.

       1mfocusin   validateCommand 22mwill be called when the entry receives focus.

       1mfocusout  validateCommand 22mwill be called when the entry loses focus.

       1mkey       validateCommand 22mwill be called when the entry is edited.

       1mall       validateCommand 22mwill be called for all above conditions.

       It  is  posible to perform percent substitutions on the 1mvalidateCommand0m
       and 1minvalidCommand22m, just as you would in a 1mbind 22mscript.  The  following
       substitutions are recognized:


       1m%d   22mType  of  action:  1  for  1minsert22m,  0 for 1mdelete22m, or -1 for focus,
            forced or textvariable validation.

       1m%i   22mIndex of char string to be inserted/deleted, if any, otherwise -1.

       1m%P   22mThe value of the entry should edition occur.  If you are configur-
            ing the entry widget to have a new textvariable, this will be  the
            value of that textvariable.

       1m%s   22mThe current value of entry before edition.

       1m%S   22mThe text string being inserted/deleted, if any, {} otherwise.

       1m%v   22mThe type of validation currently set.

       1m%V   22mThe  type of validation that triggered the callback (key, focusin,
            focusout, forced).

       1m%W   22mThe name of the entry widget.

       In general, the 1mtextVariable 22mand 1mvalidateCommand 22mcan  be  dangerous  to
       mix.  Any problems have been overcome so that using the 1mvalidateCommand0m
       will not interfere with the traditional behavior of the  entry  widget.
       Using  the  1mtextVariable  22mfor read-only purposes will never cause prob-
       lems.  The danger comes when you try set the 1mtextVariable 22mto  something
       that  the  1mvalidateCommand  22mwould  not accept, which causes 1mvalidate 22mto
       become 4mnone24m (the 1minvalidCommand 22mwill not be triggered).  The same  hap-
       pens when an error occurs evaluating the 1mvalidateCommand22m.

       Primarily,  an error will occur when the 1mvalidateCommand 22mor 1minvalidCom-0m
       1mmand 22mencounters an error in its script while evaluating or 1mvalidateCom-0m
       1mmand  22mdoes  not  return a valid tcl boolean value.  The 1mvalidate 22moption
       will also set itself to 1mnone 22mwhen you edit the entry widget from within
       either  the  1mvalidateCommand 22mor the 1minvalidCommand22m.  Such editions will
       override the one that was being validated.  If you  wish  to  edit  the
       entry  widget  (for  example  set it to {}) during validation and still
       have the 1mvalidate 22moption set, you should include the command
                   4mafter24m 4midle24m 4m{%W24m 4mconfig24m 4m-validate24m 4m%v}0m
       in the 1mvalidateCommand 22mor 1minvalidCommand 22m(whichever one you were  edit-
       ing the entry widget from).  It is also recommended to not set an asso-
       ciated 1mtextVariable 22mduring validation, as that can cause the entry wid-
       get to become out of sync with the 1mtextVariable22m.


1mWIDGET COMMAND0m
       The  1mentry  22mcommand  creates  a new Tcl command whose name is 4mpathName24m.
       This command may be used to invoke various operations  on  the  widget.
       It has the following general form:
              4mpathName24m 4moption24m ?4marg24m 4marg24m 4m...24m?
       4mOption24m and the 4marg24ms determine the exact behavior of the command.

       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:

       4mnumber24m      Specifies  the character as a numerical index, where 0 cor-
                   responds to the first character in the string.

       1manchor      22mIndicates the anchor point for the selection, which is  set
                   with the 1mselect from 22mand 1mselect adjust 22mwidget commands.

       1mend         22mIndicates  the  character  just  after  the last one in the
                   entry's string.  This is equivalent to specifying a numeri-
                   cal index equal to the length of the entry's string.

       1minsert      22mIndicates the character adjacent to and immediately follow-
                   ing the insertion cursor.

       1msel.first   22mIndicates the first character in the selection.  It  is  an
                   error  to use this form if the selection isn't in the entry
                   window.

       1msel.last    22mIndicates the character just after  the  last  one  in  the
                   selection.   It  is an error to use this form if the selec-
                   tion isn't in the entry window.

       1m@4m22mnumber24m     In this form, 4mnumber24m is treated as an x-coordinate  in  the
                   entry's  window;   the character spanning that x-coordinate
                   is used.  For example, ``1m@022m'' indicates the left-most char-
                   acter in the window.

       Abbreviations  may  be  used  for any of the forms above, e.g. ``1me22m'' or
       ``1msel.f22m''.  In general, out-of-range indices are automatically  rounded
       to the nearest legal value.

       The following commands are possible for entry widgets:

       4mpathName24m 1mbbox 4m22mindex0m
              Returns  a  list  of four numbers describing the bounding box of
              the character given by 4mindex24m.  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.

       4mpathName24m 1mcget 4m22moption0m
              Returns  the  current value of the configuration option given by
              4moption24m.  4mOption24m may have any of the values accepted by the 1mentry0m
              command.

       4mpathName24m 1mconfigure 22m?4moption24m? ?4mvalue24m 4moption24m 4mvalue24m 4m...24m?
              Query  or modify the configuration options of the widget.  If no
              4moption24m is specified, returns a list describing all of the avail-
              able  options for 4mpathName24m (see 1mTk_ConfigureInfo 22mfor information
              on the format of this list).  If 4moption24m  is  specified  with  no
              4mvalue24m,  then the command returns a list describing the one named
              option (this list will be identical to the corresponding sublist
              of  the  value  returned  if no 4moption24m is specified).  If one or
              more 4moption-value24m 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.  4mOption24m may  have  any
              of the values accepted by the 1mentry 22mcommand.

       4mpathName24m 1mdelete 4m22mfirst24m ?4mlast24m?
              Delete one or more elements of the entry.  4mFirst24m is the index of
              the first character to delete, and 4mlast24m  is  the  index  of  the
              character  just  after  the  last  one to delete.  If 4mlast24m isn't
              specified it defaults to 4mfirst24m+1, i.e.  a  single  character  is
              deleted.  This command returns an empty string.

       4mpathName24m 1mget0m
              Returns the entry's string.

       4mpathName24m 1micursor 4m22mindex0m
              Arrange for the insertion cursor to be displayed just before the
              character given by 4mindex24m.  Returns an empty string.

       4mpathName24m 1mindex 4m22mindex0m
              Returns the numerical index corresponding to 4mindex24m.

       4mpathName24m 1minsert 4m22mindex24m 4mstring0m
              Insert the characters of 4mstring24m just before the character  indi-
              cated by 4mindex24m.  Returns an empty string.

       4mpathName24m 1mscan 4m22moption24m 4margs0m
              This  command  is used to implement scanning on entries.  It has
              two forms, depending on 4moption24m:

              4mpathName24m 1mscan mark 4m22mx0m
                     Records 4mx24m and the current view in the entry window;  used
                     in  conjunction  with  later 1mscan dragto 22mcommands.  Typi-
                     cally this command is  associated  with  a  mouse  button
                     press in the widget.  It returns an empty string.

              4mpathName24m 1mscan dragto 4m22mx0m
                     This  command computes the difference between its 4mx24m argu-
                     ment and the 4mx24m argument to the last 1mscan mark 22mcommand for
                     the widget.  It then adjusts the view left or right by 10
                     times the difference in x-coordinates.  This  command  is
                     typically associated with mouse motion events in the wid-
                     get, to produce the effect of dragging the entry at  high
                     speed  through  the window.  The return value is an empty
                     string.

       4mpathName24m 1mselection 4m22moption24m 4marg0m
              This command is used to adjust the selection  within  an  entry.
              It has several forms, depending on 4moption24m:

              4mpathName24m 1mselection adjust 4m22mindex0m
                     Locate  the end of the selection nearest to the character
                     given by 4mindex24m, and adjust that end of the  selection  to
                     be  at  4mindex24m (i.e including but not going beyond 4mindex24m).
                     The other end of the selection is made the  anchor  point
                     for  future  1mselect  to 22mcommands.  If the selection isn't
                     currently in the entry, then a new selection  is  created
                     to  include  the  characters  between  4mindex24m and the most
                     recent selection anchor  point,  inclusive.   Returns  an
                     empty string.

              4mpathName24m 1mselection clear0m
                     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.

              4mpathName24m 1mselection from 4m22mindex0m
                     Set the selection anchor point to just before the charac-
                     ter  given  by  4mindex24m.   Doesn't  change  the  selection.
                     Returns an empty string.

              4mpathName24m 1mselection present0m
                     Returns  1  if  there  is  are characters selected in the
                     entry, 0 if nothing is selected.

              4mpathName24m 1mselection range 4m22mstart24m 4mend0m
                     Sets the selection to  include  the  characters  starting
                     with  the  one  indexed  by 4mstart24m and ending with the one
                     just before 4mend24m.  If 4mend24m refers to the same character  as
                     4mstart24m  or  an  earlier one, then the entry's selection is
                     cleared.

              4mpathName24m 1mselection to 4m22mindex0m
                     If 4mindex24m is before the anchor point, set the selection to
                     the  characters  from  4mindex24m  up to but not including the
                     anchor point.  If 4mindex24m is the same as the anchor  point,
                     do  nothing.  If 4mindex24m is after the anchor point, set the
                     selection to the characters from the anchor point  up  to
                     but  not including 4mindex24m.  The anchor point is determined
                     by the most recent 1mselect from 22mor 1mselect  adjust  22mcommand
                     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.

       4mpathName24m 1mvalidate0m
              This command is used to force an evaluation of the  1mvalidateCom-0m
              1mmand  22mindependent  of  the  conditions specified by the 1mvalidate0m
              option.  This is done by temporarily setting the 1mvalidate 22moption
              to 1mall22m.  It returns 0 or 1.

       4mpathName24m 1mxview 4m22margs0m
              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 fol-
              lowing forms:

              4mpathName24m 1mxview0m
                     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  ele-
                     ment  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  1m-xscrollcommand0m
                     option.

              4mpathName24m 1mxview 4m22mindex0m
                     Adjusts  the  view  in  the  window so that the character
                     given by 4mindex24m is displayed at the left edge of the  win-
                     dow.

              4mpathName24m 1mxview moveto 4m22mfraction0m
                     Adjusts  the  view  in  the  window so that the character
                     4mfraction24m of the way through the text appears at the  left
                     edge  of the window.  4mFraction24m must be a fraction between
                     0 and 1.

              4mpathName24m 1mxview scroll 4m22mnumber24m 4mwhat0m
                     This command shifts the view in the window left or  right
                     according to 4mnumber24m and 4mwhat24m.  4mNumber24m must be an integer.
                     4mWhat24m must be either 1munits 22mor 1mpages 22mor an abbreviation  of
                     one of these.  If 4mwhat24m is 1munits22m, the view adjusts left or
                     right by 4mnumber24m average-width characters on the  display;
                     if  it  is  1mpages 22mthen the view adjusts by 4mnumber24m screen-
                     fuls.  If 4mnumber24m is negative then characters  farther  to
                     the  left become visible;  if it is positive then charac-
                     ters farther to the right become visible.


1mDEFAULT BINDINGS0m
       Tk automatically creates class bindings for entries that give them  the
       following default behavior.  In the descriptions below, ``word'' refers
       to a contiguous group of letters, digits, or ``_'' characters,  or  any
       single character other than these.

       [1]    Clicking  mouse  button  1  positions  the insertion cursor just
              before the character underneath the mouse cursor, sets the input
              focus  to  this  widget, and clears any selection in the widget.
              Dragging with mouse button 1 strokes out a selection between the
              insertion cursor and the character under the mouse.

       [2]    Double-clicking  with  mouse button 1 selects the word under the
              mouse and positions the insertion cursor at the beginning of the
              word.  Dragging after a double click will stroke out a selection
              consisting of whole words.

       [3]    Triple-clicking with mouse button 1 selects all of the  text  in
              the  entry  and  positions the insertion cursor before the first
              character.

       [4]    The ends of the selection can be adjusted by dragging with mouse
              button  1 while the Shift key is down;  this will adjust the end
              of the selection that was nearest to the mouse cursor when  but-
              ton 1 was pressed.  If the button is double-clicked before drag-
              ging then the selection will  be  adjusted  in  units  of  whole
              words.

       [5]    Clicking  mouse button 1 with the Control key down will position
              the insertion cursor in the entry without affecting  the  selec-
              tion.

       [6]    If  any  normal  printing characters are typed in an entry, they
              are inserted at the point of the insertion cursor.

       [7]    The view in the entry can be adjusted  by  dragging  with  mouse
              button  2.   If  mouse  button  2  is clicked without moving the
              mouse, the selection is copied into the entry at the position of
              the mouse cursor.

       [8]    If  the  mouse  is dragged out of the entry on the left or right
              sides while button 1 is pressed, the  entry  will  automatically
              scroll  to  make  more  text visible (if there is more text off-
              screen on the side where the mouse left the window).

       [9]    The Left and Right keys move the insertion cursor one  character
              to  the  left  or  right;   they also clear any selection in the
              entry and set the selection anchor.  If Left or Right  is  typed
              with the Shift key down, then the insertion cursor moves and the
              selection is extended to include the  new  character.   Control-
              Left  and  Control-Right move the insertion cursor by words, and
              Control-Shift-Left and Control-Shift-Right  move  the  insertion
              cursor  by  words  and also extend the selection.  Control-b and
              Control-f behave the  same  as  Left  and  Right,  respectively.
              Meta-b  and  Meta-f behave the same as Control-Left and Control-
              Right, respectively.

       [10]   The Home key, or Control-a, will move the  insertion  cursor  to
              the beginning of the entry and clear any selection in the entry.
              Shift-Home moves the insertion cursor to the  beginning  of  the
              entry and also extends the selection to that point.

       [11]   The End key, or Control-e, will move the insertion cursor to the
              end of the entry and clear any selection in the  entry.   Shift-
              End  moves  the  cursor  to the end and extends the selection to
              that point.

       [12]   The Select key and Control-Space set the selection anchor to the
              position of the insertion cursor.  They don't affect the current
              selection.   Shift-Select  and  Control-Shift-Space  adjust  the
              selection  to  the  current  position  of  the insertion cursor,
              selecting from the anchor to the insertion cursor if  there  was
              not any selection previously.

       [13]   Control-/ selects all the text in the entry.

       [14]   Control-\ clears any selection in the entry.

       [15]   The  F16  key (labelled Copy on many Sun workstations) or Meta-w
              copies the selection in the widget to the clipboard, if there is
              a selection.

       [16]   The F20 key (labelled Cut on many Sun workstations) or Control-w
              copies the selection in the widget to the clipboard and  deletes
              the  selection.   If  there  is  no selection in the widget then
              these keys have no effect.

       [17]   The F18 key (labelled Paste on many Sun  workstations)  or  Con-
              trol-y  inserts the contents of the clipboard at the position of
              the insertion cursor.

       [18]   The Delete key deletes the selection, if there  is  one  in  the
              entry.   If  there  is no selection, it deletes the character to
              the right of the insertion cursor.

       [19]   The BackSpace key and Control-h delete the selection,  if  there
              is  one  in the entry.  If there is no selection, it deletes the
              character to the left of the insertion cursor.

       [20]   Control-d deletes the character to the right  of  the  insertion
              cursor.

       [21]   Meta-d deletes the word to the right of the insertion cursor.

       [22]   Control-k  deletes all the characters to the right of the inser-
              tion cursor.

       [23]   Control-t reverses the order of the two characters to the  right
              of the insertion cursor.

       If the entry is disabled using the 1m-state 22moption, 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 behavior of entries can be changed by  defining  new  bindings  for
       individual widgets or by redefining the class bindings.


1mKEYWORDS0m
