history(n)
π NAME π
okay so this is history(n), bestie β the manual page for history, and it literally provides a history for Entry widgets β¨ itβs giving βyour text entry has a memory nowβ and Iβm obsessed π
β¨ SYNOPSIS β¨
hereβs the synopsis, untouched and iconic:
package require Tcl 8.4
package require Tk 8.4
package require history ?0.1?
::history::init pathName ?length?
::history::remove pathName
::history::add pathName text
::history::get pathName
::history::clear pathName
::history::configure pathName option ?value?
bell
π«Ά DESCRIPTION π«Ά
okay so this package gives you a convenient history mechanism for Entry widgets. you can access the history with the Up and Down arrow keys π¦
::history::init pathName ?length?β arranges to remember the history of the namedEntrywidget. the optional length determines the number of history entries to keep, and you can change it later with::history::configure. history entries must be added with the::history::addcommand before they can be seen π::history::remove pathNameβ forgets all history entries for theEntrypathName and removes the history bindings. bye-bye memory π::history::add pathName textβ used to add history entries to anEntrythat has previously had::history::initcalled on it. call this from your Entry handler with the contents of the entry (or whatever you wish to add to the history). yes bestie, you control the lore π::history::get pathNameβ returns a list containing the history entries for theEntrypathName π::history::clear pathNameβ clears the history list for the namedEntryπ§Ή::history::configure pathName option ?value?β queries or sets configuration options. currently the options recognized arelengthandalert. setting thelengthdetermines the number of history entries to keep for the namedEntry.alertspecifies the command to run when the user reaches the end of the history, and it defaults tobell. althoughconfigurerequires a pathName argument, the setting foralertis global and the path is ignored π
then thereβs this example, which I am placing here exactly because the vibes must be preserved:
entry .e
bind .e <Return> [list ProcessEntry %W]
::history::init .e
pack .e
proc ProcessEntry {w} {
set text [$w get]
if {$text == ""} { return }
::history::add $w $text
puts $text
$w delete 0 end
}
π BUGS, IDEAS, FEEDBACK π
okay so this document and the package it describes will undoubtedly contain bugs and other problems π please report such in the category entry::history of the Tklib Trackers [http://core.tcl.tk/tklib/reportlist]. also please report any ideas for enhancements you may have for either package and/or documentation π«Ά no gatekeeping, bestie.
π KEYWORDS π
entry, history π
signed off with sparkle: source/version tklib 0.1, manual history(n) β no date in the footer, so consider this the forever-vibe date ππ
π¦ where this page comes from
- alpine 3.24: tk-lib-doc 0.7-r0 Β· TCL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms