]>
cvs.zerfleddert.de Git - micropolis/blob - src/tk/library/entry.tcl
3 # This file contains Tcl procedures used to manage Tk entries.
5 # $Header: /user6/ouster/wish/scripts/RCS/entry.tcl,v 1.2 92/05/23 16:40:57 ouster Exp $ SPRITE (Berkeley)
7 # Copyright 1992 Regents of the University of California
8 # Permission to use, copy, modify, and distribute this
9 # software and its documentation for any purpose and without
10 # fee is hereby granted, provided that this copyright
11 # notice appears in all copies. The University of California
12 # makes no representations about the suitability of this
13 # software for any purpose. It is provided "as is" without
14 # express or implied warranty.
17 # The procedure below is invoked to backspace over one character
18 # in an entry widget. The name of the widget is passed as argument.
20 proc tk_entryBackspace w
{
21 set x
[expr {[$w index cursor
] - 1}]
22 if {$x != -1} {$w delete
$x}
25 # The procedure below is invoked to backspace over one word in an
26 # entry widget. The name of the widget is passed as argument.
28 proc tk_entryBackword w
{
30 set curs
[expr [$w index cursor
]-1]
32 for {set x
$curs} {$x > 0} {incr x
-1} {
33 if {([string first
[string index
$string $x] " \t"] < 0)
34 && ([string first
[string index
$string [expr $x-1]] " \t"]
42 # The procedure below is invoked after insertions. If the caret is not
43 # visible in the window then the procedure adjusts the entry's view to
44 # bring the caret back into the window again.
46 proc tk_entrySeeCaret w
{
47 set c
[$w index cursor
]
48 set left
[$w index
@0]
53 while {[$w index
@[expr [winfo width
$w]-5]] < $c} {
54 set left
[expr $left+1]