widget_dateentry(n)

πŸ“¦ version 0.7, in alpine 3.24

πŸ’… widget_dateentry(n) β€” the date picker megawidget bestie

so this page lives in the Various megawidgets section of the manual, and it's literally all about the date entry megawidget, aka widget_dateentry. come get your calendar popup πŸŽ€


✨ SYNOPSIS ✨

okay so first things first, you gotta have the right packages loaded, no cap:

package require Tcl  8.4

package require Tk  8.4

package require widget  ?3.0?

package require widget::dateentry  ?0.96?

widget::dateentry pathname ?options?

those ?3.0? and ?0.96? bits are optional version constraints, iykyk πŸ¦‹


🌸 DESCRIPTION 🌸

this package gives you a dateentry megawidget β€” and yes bestie, it's a snidget πŸ’…. it's built on top of an ttk::entry, which means every single widget command that ttk::entry has is also available on the dateentry. slay, inheritance!

the invocation is literally:

widget::dateentry pathname ?options?

give it a pathname and some ?options? and you're off 🌈


πŸŽ€ WIDGET OPTIONS πŸŽ€

here's the whole menu of flags, no skips, no cuts:

  • -command β€” a script that gets evaluated when a date was selected πŸ”₯
  • -dateformat β€” the format of the date that is returned. default is %m/%d/%Y ⭐
  • -firstday β€” see the calendar man page πŸ‘€
  • -font β€” picks the font used in the widget. it defaults to Helvetica 9 ✨
  • -highlightcolor β€” see the calendar man page πŸ‘€
  • -language β€” see the calendar man page πŸ‘€
  • -shadecolor β€” see the calendar man page πŸ‘€
  • -showpast β€” see the calendar man page πŸ‘€
  • -textvariable β€” names a variable whose value is linked to the entry widget's contents. whenever the variable changes value, the widget's contents get updated, and vice versa πŸ’–
ngl, a bunch of these are just "go read the calendar man page" and that's so valid of them. the calendar page is the main character here 🫢

πŸ‘‘ WIDGET COMMAND πŸ‘‘

just one command, and it's the good one:

  • pathname get β€” returns the selected date πŸ—“οΈ

πŸ¦‹ DEFAULT BINDINGS πŸ¦‹

the moment the dateentry widget is created, these bindings get installed. for navigation within the calendar itself, go check its manpage, bestie.

  • Button-1 β€” accept and select the date and close the calendar window πŸ–±οΈ
  • Return, space β€” accept the selected date and close the calendar window ⌨️
  • Escape β€” close calendar window πŸ™ˆ
  • Control-space β€” show calendar window ✨

not me memorizing these β€” Ctrl+space to pop the calendar open, Escape to bail. iconic.


πŸ’œ EXAMPLE πŸ’œ

here's the whole vibe, copy it exactly:

package require widget::dateentry; # or widget::all
set t [widget::dateentry .de]
pack $t -fill x -expand 1

three lines, a whole date picker, we ate πŸ”₯


πŸ’€ BUGS, IDEAS, FEEDBACK πŸ’€

real talk: this document, and the package it describes, will undoubtedly contain bugs and other problems. that's just how it is 😭. please report them in the category widget::dateentry of the Tklib Trackers at [http://core.tcl.tk/tklib/reportlist].

also please report any ideas for enhancements you may have for either the package and/or the documentation. we want all of it, fr fr 🫢


⭐ KEYWORDS ⭐

date, dateentry, megawidget, snit, widget


🌈 CATEGORY 🌈

Widget


okay bye bestie, go pick some dates πŸ’–

mwah πŸ’‹ β€” this page is from tklib, version 0.96, and it's the widget_dateentry(n) manual page. see u in the group chat πŸŽ€

πŸ“¦ where this page comes from