Tickit...::HBox(3pm)

πŸ’– Tickit::Widget::HBox β€” the horizontal-row glow-up πŸ’–

okay bestie, so this page is from the User Contributed Perl Documentation collection, and it's all about Tickit::Widget::HBox β€” the widget that lines your babies up side by side like a little row of besties linking arms 🫢


✨ NAME ✨

Tickit::Widget::HBox β€” distribute child widgets in a horizontal row 🌈


✨ SYNOPSIS ✨

use Tickit;
use Tickit::Widget::HBox;
use Tickit::Widget::Static;

my $hbox = Tickit::Widget::HBox->new;

foreach my $position (qw( left centre right )) {
   $hbox->add(
      Tickit::Widget::Static->new(
         text   => $position,
         align  => $position,
         valign => "middle",
      ),
      expand => 1
   );
}

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

like, look at that. three little statics, all chill, all in a row, all expand => 1. the alignment is literally doing the most and we love that for them πŸ’…


✨ DESCRIPTION ✨

So Tickit::Widget::HBox is a subclass of Tickit::Widget::LinearBox, and its whole personality is: put the children in a horizontal row. That's it. That's the vibe.

Its height will be the height of the tallest child (iconic β€” the tall one sets the standard, no cap). Its width will be the sum of the widths of all the children, plus the inter-child spacing.

And then β€” okay this is the cute part β€” optionally, if you give it a non-zero spacing between child widgets and a style to draw in, a vertical dividing line gets drawn between each child. A little fence between your friends. Aesthetic. ✨


πŸŽ€ STYLE πŸŽ€

The default style pen is used as the widget pen, periodt. The following style pen prefixes are also used:

  • line => PEN β€” the pen used to render a dividing line between child widgets. πŸ–ŠοΈ (Since version 0.52.)
⚠️ Heads up bestie: the widget pen is mutable, and changes to it will result in immediate redrawing β€” but any changes you made will be LOST if the widget style is changed. gone. poof. πŸ’€ so don't get attached.

The following style keys are used:

  • spacing => INT β€” the number of columns of spacing between children πŸ“
  • line_style => INT β€” (Since version 0.52.) if set, the style to draw a dividing line between each child widget. Must be one of the LINE_* constants from Tickit::RenderBuffer. no freelancing, it has to be one of those ⭐

πŸ‘‘ AUTHOR πŸ‘‘

Paul Evans <leonerd@leonerd.org.uk> β€” thank you king 🫢


okay that's the whole page, you're fully caught up, go build your little row of widgets and slay πŸ’–

this was brought to you by perl v5.40.0, dated 2024-09-16, living under the name Tickit...::HBox(3pm) in the User Contributed Perl Documentation β€” mwah, bye bestie πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from