Tickit...Choice(3pm)
π Tickit...Choice(3pm) β the widget that lets your user pick a fave
okay so Tickit::Widget::Choice is literally a widget that gives you a choice from a list. that's the whole vibe. it's the group-chat poll of Tickit widgets, and honestly? iconic. π
β¨ CONSTRUCTOR β¨
πΈ new
$choice = Tickit::Widget::Choice->new( %args )
this bad boy constructs a brand-new Tickit::Widget::Choice object. main character energy from the jump. β¨
it takes these named arguments, bestie:
choices => ARRAYβ optional, no cap. if you pass it, it's gotta be an ARRAY reference full of two-element ARRAY references. each one gets added to the list of choices, just like if you'd calledpush_choiceon every element in that array. π«Άon_changed => CODEβ optional too. if you supply it, it sets the initial value of theon_changedevent handler. basically pre-loading your callback so it's ready to go. π
π¦ ACCESSORS π¦
on_changed
$on_changed = $self->on_changed
set_on_changed
$self->set_on_changed( $on_changed )
these two return or set the CODE reference that gets called whenever the chosen selection changes. it's giving "text me when you change your mind" fr fr. π
$on_changed->( $choice, $value )
π METHODS π
π push_choice
$choice->push_choice( $value, $caption )
appends another choice to the list, with the value and the display caption you give it. one more option in the group chat. slay. π
π chosen_value
$value = $choice->chosen_value
returns the value of the currently-chosen choice. the winner. the one that ate. π
π choose_by_idx
$choice->choose_by_idx( $idx )
moves the chosen choice to the one at the given index. and listen β if this wasn't the previously-chosen one, it invokes the on_changed event. so don't be surprised when your callback fires. π₯
β choose_by_value
$choice->choose_by_value( $value )
moves the chosen choise to the one having the given value β but only if such a choice actually exists, iykyk. if this wasn't the previously-chosen one, it invokes the on_changed event. same deal as above. β¨
π§ popup_menu
$choice->popup_menu
displays the popup menu in a modal float and just... waits there until a choice is made. very "we're not leaving until everyone agrees" energy. π
πΈ TODO πΈ
- render a full border around the widget if height is at least
3. that's the whole item. we'll get to it. π
π«Ά AUTHOR π«Ά
Paul Evans <leonerd@leonerd.org.uk> β king behaviour, honestly. π
lowkey a whole widget, highkey just vibes. go forth and let your users choose bestie. ππ
that's the page, babe β perl v5.42.2, dated 2026-02-15, straight from the Tickit...Choice(3pm) section of the User Contributed Perl Documentation. mwah. π
π¦ where this page comes from
- alpine 3.24: perl-tickit-widget-choice-doc 0.07-r1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms