Tickit...VSplit(3pm)

πŸ’– Tickit::Widget::VSplit β€” the perl one, from User Contributed Perl Documentation πŸ’–

okay bestie, so Tickit::Widget::VSplit is literally just an adjustable vertical split between two widgets. that's the whole vibe. two widgets, one lil bar between them, you drag it, everything slays. ✨


🌈 SYNOPSIS 🌈

use Tickit;
use Tickit::Widget::VSplit;
use Tickit::Widget::Static;

my $vsplit = Tickit::Widget::VSplit->new
   ->set_left_child ( Tickit::Widget::Static->new( text => "Text above" ) ),
   ->set_right_child( Tickit::Widget::Static->new( text => "Text below" ) );

Tickit->new( root => $vsplit )->run;

like. look at her. main character energy fr fr 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so this is a container widget (a girl who holds other widgets, iconic) and she holds two child widgets, and the way she shows them is side by side. πŸ’…

between them there's a vertical split bar, and that bar is not just decorative β€” it reacts to mouse click-drag events, so the user can literally adjust the proportion of space handed to each of the two widgets. drag it, the split moves, that's it, no cap. πŸŽ€


✨ STYLE ✨

the default style pen is used as the widget pen. that's just how she is. πŸ’–

the following style pen prefixes are also used:

  • split => PEN β€” the pen used to render the vertical split area 🌸

the following style keys are used:

  • spacing => INT β€” the number of columns of spacing between the left and right child widgets 🧚

the following style tags are used:

  • :active β€” set when a mouse drag resize operation is occurring πŸ‘‘

πŸŽ€ CONSTRUCTOR πŸŽ€

new

$vsplit = Tickit::Widget::VSplit->new( %args );

constructs a new Tickit::Widget::VSplit object. brand new, fresh out the box, obsessed. πŸ’–


πŸ’… ACCESSORS πŸ’…

left_child

set_left_child

$child = $hsplit->left_child;

$vsplit->set_left_child( $child );

accessor for the child widget used in the left half of the display. 🌸

right_child

set_right_child

$child = $hsplit->right_child;

$vsplit->set_right_child( $child );

accessor for the child widget used in the right half of the display. πŸ¦‹


okay and the tea on these mutators: they return the container widget itself, which makes them suitable to use as chaining mutators. so you can just keep stacking calls, one after another, no middleman variable needed. e.g. ✨

my $container = Tickit::Widget::VSplit->new( ... )
   ->set_left_child ( Tickit::Widget::Box->new ... )
   ->set_right_child( Tickit::Widget::Box->new ... );

the way that chains... it's giving effortless. 😭🫢


πŸ‘‘ AUTHOR πŸ‘‘

Paul Evans <leonerd@leonerd.org.uk> β€” the legend herself, we love her, periodt. πŸ’œ


and that's a wrap bestie!! this page came to you courtesy of perl v5.40.0, dated 2024-09-16, and yes it's still filed under Tickit...VSplit(3pm) 🩷 go forth and split some widgets, you got this πŸ’–βœ¨πŸŽ€
πŸ“¦ where this page comes from