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 . Although configure requires a pathName argument, the setting
69 for alert is global and the path is ignored.
70
71 entry .e
72 bind .e <Return> [list ProcessEntry %W]
73 ::history::init .e
74 pack .e
75
76 proc ProcessEntry {w} {
77 set text [$w get]
78 if {$text == ""} { return }
79 ::history::add $w $text
80 puts $text
81 $w delete 0 end
82 }
83
84
85
87 entry, history
88
89
90
91history 0.1 history(n)