home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / tcl / tk3.3b1 / doc / entry.n < prev    next >
Encoding:
Text File  |  1993-04-01  |  11.4 KB  |  300 lines

  1. '\"
  2. '\" Copyright (c) 1990 The Regents of the University of California.
  3. '\" All rights reserved.
  4. '\"
  5. '\" Permission is hereby granted, without written agreement and without
  6. '\" license or royalty fees, to use, copy, modify, and distribute this
  7. '\" documentation for any purpose, provided that the above copyright
  8. '\" notice and the following two paragraphs appear in all copies.
  9. '\"
  10. '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  11. '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  12. '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13. '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. '\"
  15. '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16. '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. '\" AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18. '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19. '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. '\" 
  21. '\" $Header: /user6/ouster/wish/man/RCS/entry.n,v 1.13 93/04/01 09:52:37 ouster Exp $ SPRITE (Berkeley)
  22. '/" 
  23. .so man.macros
  24. .HS entry tk
  25. .BS
  26. '\" Note:  do not modify the .SH NAME line immediately below!
  27. .SH NAME
  28. entry \- Create and manipulate entry widgets
  29. .SH SYNOPSIS
  30. \fBentry\fI \fIpathName \fR?\fIoptions\fR?
  31. .SH "STANDARD OPTIONS"
  32. .LP
  33. .nf
  34. .ta 4c 8c 12c
  35. .VS
  36. \fBbackground\fR    \fBforeground\fR    \fBinsertWidth\fR    \fBselectForeground\fR
  37. \fBborderWidth\fR    \fBinsertBackground\fR    \fBrelief\fR    \fBtextVariable\fR
  38. \fBcursor\fR    \fBinsertBorderWidth\fR    \fBscrollCommand\fR
  39. \fBexportSelection\fR    \fBinsertOffTime\fR    \fBselectBackground\fR
  40. \fBfont\fR    \fBinsertOnTime\fR    \fBselectBorderWidth\fR
  41. .VE
  42. .fi
  43. .LP
  44. See the ``options'' manual entry for details on the standard options.
  45. .SH "WIDGET-SPECIFIC OPTIONS"
  46. .ta 4c
  47. .LP
  48. .nf
  49. .VS
  50. Name:    \fBstate\fR
  51. Class:    \fBState\fR
  52. Command-Line Switch:    \fB\-state\fR
  53. .fi
  54. .IP
  55. Specifies one of two states for the entry:  \fBnormal\fR or \fBdisabled\fR.
  56. If the entry is disabled then the value may not be changed using widget
  57. commands and no insertion cursor will be displayed, even if the input focus is
  58. in the widget.
  59. .VE
  60. .LP
  61. .nf
  62. Name:    \fBwidth\fR
  63. Class:    \fBWidth\fR
  64. Command-Line Switch:    \fB\-width\fR
  65. .fi
  66. .IP
  67. Specifies an integer value indicating the desired width of the entry window,
  68. in average-size characters of the widget's font.
  69. .BE
  70.  
  71. .SH DESCRIPTION
  72. .PP
  73. The \fBentry\fR command creates a new window (given by the
  74. \fIpathName\fR argument) and makes it into an entry widget.
  75. Additional options, described above, may be specified on the
  76. command line or in the option database
  77. to configure aspects of the entry such as its colors, font,
  78. and relief.  The \fBentry\fR command returns its
  79. \fIpathName\fR argument.  At the time this command is invoked,
  80. there must not exist a window named \fIpathName\fR, but
  81. \fIpathName\fR's parent must exist.
  82. .PP
  83. An entry is a widget that displays a one-line text string and
  84. allows that string to be edited using widget commands described below, which
  85. are typically bound to keystrokes and mouse actions.
  86. When first created, an entry's string is empty.
  87. A portion of the entry may be selected as described below.
  88. .VS
  89. If an entry is exporting its selection (see the \fBexportSelection\fR
  90. option), then it will observe the standard X11 protocols for handling the
  91. .VE
  92. selection;  entry selections are available as type \fBSTRING\fR.
  93. Entries also observe the standard Tk rules for dealing with the
  94. input focus.  When an entry has the input focus it displays an
  95. \fIinsertion cursor\fR to indicate where new characters will be
  96. inserted.
  97. .PP
  98. Entries are capable of displaying strings that are too long to
  99. fit entirely within the widget's window.  In this case, only a
  100. portion of the string will be displayed;  commands described below
  101. may be used to change the view in the window.  Entries use
  102. the standard \fBscrollCommand\fR mechanism for interacting with
  103. scrollbars (see the description of the \fBscrollCommand\fR option
  104. for details).  They also support scanning, as described below.
  105.  
  106. .SH "WIDGET COMMAND"
  107. .PP
  108. The \fBentry\fR command creates a new Tcl command whose
  109. name is \fIpathName\fR.  This
  110. command may be used to invoke various
  111. operations on the widget.  It has the following general form:
  112. .DS C
  113. \fIpathName option \fR?\fIarg arg ...\fR?
  114. .DE
  115. \fIOption\fR and the \fIarg\fRs
  116. determine the exact behavior of the command.
  117. .PP
  118. Many of the widget commands for entries take one or more indices as
  119. arguments.  An index specifies a particular character in the entry's
  120. string, in any of the following ways:
  121. .TP 12
  122. \fInumber\fR
  123. Specifies the character as a numerical index, where 0 corresponds
  124. to the first character in the string.
  125. .TP 12
  126. \fBend\fR
  127. Indicates the character just after the last one in the entry's string.
  128. This is equivalent to specifying a numerical index equal to the length
  129. of the entry's string.
  130. .TP 12
  131. \fBinsert\fR
  132. .VS
  133. .VE
  134. Indicates the character adjacent to and immediately following the
  135. insertion cursor.
  136. .TP 12
  137. \fBsel.first\fR
  138. Indicates the first character in the selection.  It is an error to
  139. use this form if the selection isn't in the entry window.
  140. .TP 12
  141. \fBsel.last\fR
  142. Indicates the last character in the selection.  It is an error to
  143. use this form if the selection isn't in the entry window.
  144. .TP 12
  145. \fB@\fInumber\fR
  146. In this form, \fInumber\fR is treated as an x-coordinate in the
  147. entry's window;  the character spanning that x-coordinate is used.
  148. For example, ``\fB@0\fR'' indicates the left-most character in the
  149. window.
  150. .LP
  151. Abbreviations may be used for any of the forms above, e.g. ``\fBe\fR''
  152. or ``\fBsel.f\fR''.  In general, out-of-range indices are automatically
  153. rounded to the nearest legal value.
  154. .PP
  155. The following commands are possible for entry widgets:
  156. .TP
  157. \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?
  158. Query or modify the configuration options of the widget.
  159. If no \fIoption\fR is specified, returns a list describing all of
  160. the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
  161. information on the format of this list).  If \fIoption\fR is specified
  162. with no \fIvalue\fR, then the command returns a list describing the
  163. one named option (this list will be identical to the corresponding
  164. sublist of the value returned if no \fIoption\fR is specified).  If
  165. one or more \fIoption\-value\fR pairs are specified, then the command
  166. modifies the given widget option(s) to have the given value(s);  in
  167. this case the command returns an empty string.
  168. \fIOption\fR may have any of the values accepted by the \fBentry\fR
  169. command.
  170. .TP
  171. \fIpathName \fBdelete \fIfirst \fR?\fIlast\fR?
  172. Delete one or more elements of the entry.  \fIFirst\fR and \fIlast\fR
  173. are indices of of the first and last characters in the range to
  174. be deleted.   If \fIlast\fR isn't specified it defaults to
  175. \fIfirst\fR, i.e. a single character is deleted.  This command
  176. returns an empty string.
  177. .TP
  178. \fIpathName \fBget\fR
  179. Returns the entry's string.
  180. .TP
  181. \fIpathName \fBicursor \fIindex\fR
  182. .VS
  183. Arrange for the insertion cursor to be displayed just before the character
  184. given by \fIindex\fR.  Returns an empty string.
  185. .VE
  186. .TP
  187. \fIpathName \fBindex\fI index\fR
  188. Returns the numerical index corresponding to \fIindex\fR.
  189. .TP
  190. \fIpathName \fBinsert \fIindex string\fR
  191. Insert the characters of \fIstring\fR just before the character
  192. indicated by \fIindex\fR.  Returns an empty string.
  193. .TP
  194. \fIpathName \fBscan\fR \fIoption args\fR
  195. This command is used to implement scanning on entries.  It has
  196. two forms, depending on \fIoption\fR:
  197. .RS
  198. .TP
  199. \fIpathName \fBscan mark \fIx\fR
  200. Records \fIx\fR and the current view in the entry window;  used in
  201. conjunction with later \fBscan dragto\fR commands.  Typically this
  202. command is associated with a mouse button press in the widget.  It
  203. returns an empty string.
  204. .TP
  205. \fIpathName \fBscan dragto \fIx\fR
  206. This command computes the difference between its \fIx\fR argument
  207. and the \fIx\fR argument to the last \fBscan mark\fR command for
  208. the widget.  It then adjusts the view left or right by 10 times the
  209. difference in x-coordinates.  This command is typically associated
  210. with mouse motion events in the widget, to produce the effect of
  211. dragging the entry at high speed through the window.  The return
  212. value is an empty string.
  213. .RE
  214. .TP
  215. \fIpathName \fBselect \fIoption arg\fR
  216. This command is used to adjust the selection within an entry.  It
  217. has several forms, depending on \fIoption\fR:
  218. .RS
  219. .TP
  220. \fIpathName \fBselect adjust \fIindex\fR
  221. Locate the end of the selection nearest to the character given by
  222. \fIindex\fR, and adjust that end of the selection to be at \fIindex\fR
  223. (i.e including but not going beyond \fIindex\fR).  The other
  224. end of the selection is made the anchor point for future
  225. \fBselect to\fR commands.  If the selection
  226. isn't currently in the entry, then a new selection is created to
  227. include the characters between \fIindex\fR and the most recent
  228. selection anchor point, inclusive.
  229. Returns an empty string.
  230. .TP
  231. \fIpathName \fBselect clear\fR
  232. Clear the selection if it is currently in this widget.  If the
  233. selection isn't in this widget then the command has no effect.
  234. Returns an empty string.
  235. .TP
  236. \fIpathName \fBselect from \fIindex\fR
  237. Set the selection anchor point to just before the character
  238. given by \fIindex\fR.  Doesn't change the selection.
  239. Returns an empty string.
  240. .TP
  241. \fIpathName \fBselect to \fIindex\fR
  242. Set the selection to consist of the elements from the anchor
  243. point to element \fIindex\fR, inclusive.  The anchor point is
  244. determined by the most recent \fBselect from\fR or \fBselect adjust\fR
  245. command in this widget.  If the selection isn't in this widget
  246. then a new selection is created using the most recent anchor point
  247. specified for the widget.  Returns an empty string.
  248. .RE
  249. .TP
  250. \fIpathName \fBview \fIindex\fR
  251. Adjust the view in the entry so that element \fIindex\fR is
  252. at the left edge of the window.  Returns an empty string.
  253.  
  254. .SH "DEFAULT BINDINGS"
  255. .PP
  256. .VS
  257. Tk automatically creates class bindings for entries that give them
  258. the following default behavior:
  259. .IP [1]
  260. Clicking mouse button 1 in an entry positions the insertion cursor
  261. just before the character underneath the mouse cursor and sets the
  262. input focus to this widget.
  263. .IP [2]
  264. Dragging with mouse button 1 strokes out a selection between
  265. the insertion cursor and the character under the mouse.
  266. .IP [3]
  267. The ends of the selection can be adjusted by dragging with mouse
  268. button 1 while the shift key is down;  this will adjust the end
  269. of the selection that was nearest to the mouse cursor when button
  270. 1 was pressed.
  271. .IP [4]
  272. The view in the entry can be adjusted by dragging with mouse button 2.
  273. .IP [5]
  274. If the input focus is in an entry widget and characters are typed on the
  275. keyboard, the characters are inserted just before the insertion cursor.
  276. .IP [6]
  277. Control-h and the Backspace and Delete keys erase the character just
  278. before the insertion cursor.
  279. .IP [7]
  280. Control-w erases the word just before the insertion cursor.
  281. .IP [8]
  282. Control-u clears the entry to an empty string.
  283. .IP [9]
  284. Control-v inserts the current selection just before the insertion cursor.
  285. .IP [10]
  286. Control-d deletes the selected characters;  an error occurs if the selection
  287. is not in this widget.
  288. .PP
  289. If the entry is disabled using the \fBstate\fR option, then the entry's
  290. view can still be adjusted and text in the entry can still be selected,
  291. but no insertion cursor will be displayed and no text modifications will
  292. take place.
  293. .PP
  294. The behavior of entries can be changed by defining new bindings for
  295. individual widgets or by redefining the class bindings.
  296. .VE
  297.  
  298. .SH KEYWORDS
  299. entry, widget
  300.