1history(n) Provides a history for Entry widgets history(n)
2
3
4
5______________________________________________________________________________
6
8 history - Provides a history for Entry widgets
9
11 package require Tcl 8.4
12
13 package require Tk 8.4
14
15 package require history ?0.1?
16
17 ::history::init pathName ?length?
18
19 ::history::remove pathName
20
21 ::history::add pathName text
22
23 ::history::get pathName
24
25 ::history::clear pathName
26
27 ::history::configure pathName option ?value?
28
29 bell
30
31_________________________________________________________________
32
34 This package provides a convenient history mechanism for Entry widgets.
35 The history may be accessed with the up and down arrow keys.
36
37 ::history::init pathName ?length?
38 Arranges to remember the history of the named Entry widget. An
39 optional length determines the number of history entries to
40 keep. This may be changed later with ::history::configure. His‐
41 tory entries must be added with the ::history::add command
42 before they can be seen.
43
44 ::history::remove pathName
45 Forgets all history entries for the Entry pathName and removes
46 the history bindings.
47
48 ::history::add pathName text
49 This command is used to add history entries to an Entry that has
50 previously had ::history::init called on it. This command should
51 be called from your Entry handler with the contents of the entry
52 (or whatever you wish to add to the history).
53
54 ::history::get pathName
55 This command returns a list containing the history entries for
56 the Entry pathName
57
58 ::history::clear pathName
59 This command clears the history list for the named Entry.
60
61 ::history::configure pathName option ?value?
62 This command queries or sets configuration options. Currently
63 the options recognized are length and alert. Setting the length
64 determines the number of history entries to keep for the named
65 Entry. Alert specifies the command to run when the user reaches
66 the end of the history, it defaults to
67
68 bell
69
70 entry .e
71 bind .e <Return> [list ProcessEntry %W]
72 ::history::init .e
73 pack .e
74
75 proc ProcessEntry {w} {
76 set text [$w get]
77 if {$text == ""} { return }
78 ::history::add $w $text
79 puts $text
80 $w delete 0 end
81 }
82
83
84
86 entry, history
87
88
89
90history 0.1 history(n)