Tickit...::Menu(3pm)

πŸ“¦ version 0.16, in alpine 3.24

πŸ’– Tickit::Widget::Menu β€” display a menu of choices πŸ’–

okay so bestie, this is page Tickit...::Menu(3pm) from the User Contributed Perl Documentation, and it's literally all about Tickit::Widget::Menu. It's giving menu widget, it's giving choices, it's giving transient pop-up realness. πŸ’…βœ¨


🌸 NAME 🌸

Tickit::Widget::Menu β€” display a menu of choices πŸŽ€


✨ SYNOPSIS ✨

use Tickit;
use Tickit::Widget::Menu;

my $tickit = Tickit->new;

my $menu = Tickit::Widget::Menu->new(
   items => [
      Tickit::Widget::Menu::Item->new(
         name => "Exit",
         on_activate => sub { $tickit->stop }
      ),
   ],
);

$menu->popup( $tickit->rootwin, 5, 5 );

$tickit->run;

πŸ¦‹ DESCRIPTION πŸ¦‹

This widget class is a display container for a list of items that each represent an individual choice. It can show up as a floating window using the popup method, or it can be attached to a Tickit::Widget::MenuBar or used as a child menu inside another Tickit::Widget::Menu. 🌈

This widget is meant to be displayed transiently β€” either as a pop-up menu over some other widget, or as a child menu of another menu or an instance of a menu bar. And fr fr, pay attention here: such objects should not be directly added to container widgets. πŸ™ˆπŸ’€


πŸŽ€ STYLE πŸŽ€

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

  • highlight => PEN β€” the pen used to highlight the active menu selection πŸ’–

The following style actions are used:

  • highlight_next (<Down>) and highlight_prev (<Up>) β€” highlight the next or previous item πŸ¦‹
  • activate (<Enter>) β€” activate the highlighted item πŸ”₯
  • dismiss (<Escape>) β€” dismiss the menu 🌸

πŸ‘‘ CONSTRUCTOR πŸ‘‘

πŸ’œ new

$menu = Tickit::Widget::Menu->new( %args )

Constructs a new Tickit::Widget::Menu object. Slay. ✨

It takes the following named arguments:

  • name => STRING β€” optional. If present, gives the name of the menu item for a submenu. Not used in a top-level menu. πŸ’…
  • items => ARRAY β€” optional. If present, contains a list of Tickit::Widget::Menu::Item or Tickit::Widget::Menu objects to add to the menu. Equivalent to passing each to the push_item method after construction. πŸŽ€

πŸ“ separator

$separator = Tickit::Window::Menu->separator

Returns a special menu item which draws a separation line between its neighbours. Cute divider energy, honestly. πŸ’–


πŸ’… METHODS πŸ’…

🌟 name

$name = $menu->name

Returns the string name for the menu.

🌸 items

@items = $menu->items

Returns the list of items currently stored.

πŸ¦‹ push_item

$menu->push_item( $item )

Adds another item.

Each item may either be created using Tickit::Window::Menu::Item's constructor, another Tickit::Widget::Menu item itself (to create a submenu), or the special separator value.

✨ highlight_item

$menu->highlight_item( $idx )

Gives the selection highlight to the item at the given index. This may be called before the menu is actually displayed in order to pre-select the highlight initially.

$menu->popup( $win, $line, $col )

Makes the menu appear at the given position relative to the given window. Note that as $win->make_popup is called, the menu is always displayed in a popup window, floating over the root window. The passed window is used simply as the origin for the given line and column position. πŸ‘‘

🌈 dismiss

$menu->dismiss

Hides a menu previously displayed using popup.


πŸ’Œ AUTHOR πŸ’Œ

Paul Evans <leonerd@leonerd.org.uk> 🫢


source/version: perl v5.42.2; date: 2026-02-15 β€” byeee bestie, stay hydrated and close your popups properly πŸ’–βœ¨

πŸ“¦ where this page comes from