Tickit...HSplit(3pm)
π Tickit::Widget::HSplit β bestie edition π
okay so real talk, this one lives in the User Contributed Perl Documentation section, and the manual name is Tickit...HSplit(3pm). it's literally a widget that puts a lil adjustable horizontal split between two widgets. so much power. so few lines of code. i'm obsessed. π
β¨ NAME β¨
Tickit::Widget::HSplit β an adjustable horizontal split between two widgets π«Ά
πΈ SYNOPSIS πΈ
use Tickit;
use Tickit::Widget::HSplit;
use Tickit::Widget::Static;
my $hsplit = Tickit::Widget::HSplit->new
->set_top_child ( Tickit::Widget::Static->new( text => "Text above" ) )
->set_bottom_child( Tickit::Widget::Static->new( text => "Text below" ) );
Tickit->new( root => $hsplit )->run;
see how cute that is?? you literally chain it. no cap. π
π¦ DESCRIPTION π¦
okay so this is a container widget, right? it holds two child widgets, and they get displayed one above the other. simple. iconic. π
and between them? a horizontal split bar. that bar reacts to mouse click-drag events, which means the user can drag it and adjust how much space each of the two widgets gets. main character energy fr fr. β¨
π STYLE π
so the default style pen is used as the widget pen. but also β the following style pen prefixes are used too:
split=> PEN β the pen used to render the horizontal split area
and the following style keys are used:
spacing=> INT β the number of lines of spacing between the top and bottom child widgets
and the following style tags are used:
:activeβ set when a mouse drag resize operation is occurring
lowkey important. highkey useful. π
π CONSTRUCTOR π
β¨ new
$hsplit = Tickit::Widget::HSplit->new( %args );
constructs a new Tickit::Widget::HSplit object. brand new baby widget. slay. π
π ACCESSORS π
β top_child / set_top_child
$child = $hsplit->top_child;
$hsplit->set_top_child( $child );
accessor for the child widget used in the top half of the display. that's it, that's the vibe. πΈ
β bottom_child / set_bottom_child
$child = $hsplit->bottom_child;
$hsplit->set_bottom_child( $child );
accessor for the child widget used in the bottom half of the display. equally iconic, equally essential. π
okay and here's the part i really need you to clock bestie: these mutators return the container widget itself, which makes them suitable to use as chaining mutators. so you can do this:
my $container = Tickit::Widget::HSplit->new( ... )
->set_top_child ( Tickit::Widget::Box->new ... )
->set_bottom_child( Tickit::Widget::Box->new ... );
the way it just flows?? ate. no notes. π₯
π AUTHOR π
Paul Evans <leonerd@leonerd.org.uk> β legend behavior, honestly. π«Ά
and that's the whole page!! perl v5.40.0, dated 2024-09-16 β mwah, go build something cute with it bestie πβ¨ππ¦πΈ
π¦ where this page comes from
- ubuntu resolute: libtickit-widgets-perl 0.42-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtickit-widgets-perl 0.42-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms