history(3tk)

πŸ“¦
version 0.9 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ history(3tk) ✨

okay so bestie, gather round, because this is the history(3tk) page and it's literally about giving your Entry widgets a memory πŸ’– no cap.


🌸 NAME 🌸

history β€” it provides a history for Entry widgets. that's it, that's the whole vibe ✨


πŸŽ€ SYNOPSIS πŸŽ€

package require Tcl 8.4

package require Tk 8.4

package require history ?0.3?

::history::init pathName ?length?

::history::remove pathName

::history::add pathName text

::history::get pathName

::history::clear pathName

::history::configure pathName option ?value?

bell

πŸ’… DESCRIPTION πŸ’…

So this package hands you a genuinely convenient history mechanism for Entry widgets, fr fr. You reach the history with the up and down arrow keys. iconic behavior honestly πŸ¦‹

🌈 ::history::init pathName ?length?

This arranges to remember the history of the named Entry widget. There's an optional length and it decides how many history entries to keep. You can change that later with ::history::configure β€” lowkey flexible πŸ‘‘

heads up bestie: history entries have to be added with the ::history::add command before they can be seen. they don't just appear out of thin air, okay? 😭

🌈 ::history::remove pathName

Forgets all history entries for the Entry pathName and removes the history bindings. it's giving memory wipe πŸ’€

🌈 ::history::add pathName text

Use this to add history entries to an Entry that has previously had ::history::init called on it. Call it from your Entry handler, passing the contents of the entry (or literally whatever you wish to add to the history). you do the choosing 🫢

🌈 ::history::get pathName

Returns a list containing the history entries for the Entry pathName. your receipts, bestie 🧾✨

🌈 ::history::clear pathName

Clears the history list for the named Entry. poof, gone, periodt πŸ’…

🌈 ::history::configure pathName option ?value?

Queries or sets configuration options. Right now the options it recognizes are length and alert.

  • Setting the length determines the number of history entries to keep for the named Entry.
  • alert specifies the command to run when the user reaches the end of the history, and it defaults to bell.
ngl this part is a lil quirky: although configure requires a pathName argument, the setting for alert is global and the path is ignored. so yeah, the path is just there vibing πŸ™ˆ

and here's the whole thing in action:

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 πŸ’€

This document, and the package it describes, will undoubtedly contain bugs and other problems β€” yes, even this one, we're being honest here 😭

Please report such in the category entry::history of the Tklib Trackers at http://core.tcl.tk/tklib/reportlist

Please also report any ideas for enhancements you may have for either the package and/or the documentation. we want the feedback, we're obsessed with it actually 🫢✨


πŸ‘‘ KEYWORDS πŸ‘‘

entry, history


and that's the whole page, bestie!! this was tklib version 0.3, from the history(3tk) manual, and you absolutely ate by reading all of it πŸŒˆπŸ’– go forth and give your Entry widgets a memory, mwah πŸŽ€

πŸ“¦ where this page comes from