Scrolled(3pm)
π Scrolled β the Perl/Tk page, bestie edition π
ok so this is Scrolled, from the Perl/Tk world (that's the Tk::Scrolled module, manual page Scrolled(3pm), and yeah it lives in the User Contributed Perl Documentation section π). Sit down, grab a strawberry π, we're gonna build a widget with a scrollbar attached to it.
β¨ NAME β¨
Tk::Scrolled β create a widget with attached scrollbar(s) π¦
β¨ SYNOPSIS β¨
$whatever = $parent->Scrolled(Whatever ?,-scrollbars=>where?
?,...?);
that's it, that's the whole vibe π
β¨ DESCRIPTION β¨
so basically, Perl/Tk was getting a flood of ScrlWhatever widgets everywhere β like, every single widget class was out here getting its own scrolled twin β and the maintainers said "no more, we're ending this" π. Enter the special constructor: Scrolled π
Scrolled creates a widget of the given Class Whatever with attached scrollbar(s). One constructor, all the classes, no cap. β¨
β¨ OPTIONS β¨
ok so every option besides -scrollbars (which we're about to explain, don't worry bestie) gets passed straight through to the Whatever widget's own constructor. So they're not Scrolled's options, they're the other widget's options, we're just holding them for a sec. π«Ά
-scrollbarsβ expects as its argument the position</> where the scrollbars should be created:w,eorn,sβ or a combination of them. And here's the fun part: if one or both of those positions gets prefixed witho, the scrollbar will only show up if there's a 'real' need to scroll. so it's shy, it only appears when it's actually needed π§ iykyk
β¨ ADVERTISED SUBWIDGETS β¨
go read "Subwidget" in Tk::mega to find out how to use advertised widgets, that's the homework π now here's the roster:
scrolledβ the scrolled widget. the main character πwidgetβ same asscrolledabove.widgetis the kind of widget passed to scrolled as first argument, in all lowercase. so if you passedWhatever, you getwhatever. lowercase era πxscrollbarβ the Scrollbar widget used for horizontal scrolling (if it exists)yscrollbarβ the Scrollbar widget used for vertical scrolling (if it exists)cornerβ a frame in the corner between the vertical and horizontal scrolbar
π yes, "scrolbar" is spelled like that up there in the corner one. we keep it exactly as it is, periodt.
β¨ BUGS β¨
ok this part is important, listen up π
If a widget does not support -{x,y}scrollcommand options, Scrolled does not complain if the specified widget class does not support them. Like, for example:
$parent->Scrolled('Button', ...)
and also β you do not get an error message or a warning when you try to configure scrollbars after the widget has already been constructed:
$ascrolled->configure(-scrollbars => 'e');
so yeah, it'll just sit there silently and not tell you. not great, not terrible, just how it is π
β¨ SEE ALSO β¨
Tk::Scrollbarπ
β¨ KEYWORDS β¨
scrolled, scrollbar π₯
ok that's the whole page bestie, you're officially educated π β¨
this was perl v5.40.1, dated 2025-04-13 β so yeah, from the Scrolled(3pm) page, love u, bye π«ΆπΈ
π¦ where this page comes from
- debian trixie: perl-tk 1:804.036+dfsg1-5
- ubuntu questing: perl-tk 1:804.036+dfsg1-5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms