Prima::ComboBox(3)
π Prima::ComboBox(3)
ok so this page is straight outta the User Contributed Perl Documentation (yes, that's the manual name, we're fancy like that β¨), and it's all about Prima::ComboBox β the standard combo box widget. buckle up bestie, we're going in π
πΈ SYNOPSIS
ok first, the vibe check β here's the whole thing in action:
use Prima qw(Application ComboBox);
my $combo = Prima::ComboBox-> new( style => cs::DropDown, items => [ 1 .. 10 ]);
$combo-> style( cs::DropDownList );
print $combo-> text;
run Prima;
look at her go ππ
π¦ DESCRIPTION
so what even is this? it's a combo box widget β and no cap, it's literally three things glued together: an input line, a list box full of your possible selections, and an eventual drop-down button. she can show up in two whole forms: as a drop-down list that you pop open and hide again, or in a form where the selection list is just always visible. main character energy either way π
here's the tea though: the combo box is a grouping widget and contains neither painting nor user input code by itself. all of that functionality is delegated to the children widgets β the input line, the list box, and the drop button. Prima::ComboBox exports a fixed list of methods and properties from the namespaces of Prima::InputLine and Prima::ListBox. and yeah, it's possible to tweak the Prima::ComboBox (using its editClass and listClass create-only properties) so the input line and list box widgets can be instantiated from other classes. the list of exported names is stored in the package variables %listProps, %editProps, and %listDynas. these are also described in the "Exported names" section down below π«Ά
also the module defines the cs:: package for the constants used by the style property. slay.
β¨ API β¨
π Properties
autoHeightBOOLEAN β if it's 1, the widget adjusts its height automatically when its font changes. only for styles not equal tocs::Simple, bestie. Default value:1buttonClassSTRING β assigns the drop-down button class. Create-only property. Default value:Prima::WidgetbuttonDelegationsARRAY β assigns the list of delegated notifications to the drop-down button. Create-only property.buttonProfileHASH β assigns a hash of properties passed to the drop-down button during the creation. Create-only property.caseSensitiveBOOLEAN β picks whether the user input is case-sensitive or not, when a value is picked from the selection list. Default value:0editClassSTRING β assigns the input line class. Create-only property. Default value:Prima::InputLineeditProfileHASH β assigns a hash of properties passed to the input line during the creation. Create-only property.editDelegationsARRAY β assigns the list of delegated notifications to the input line. Create-only property.editHeightINTEGER β selects the height of the input line.itemsARRAY β proxy of the list widget'sitemsproperty. see Prima::Lists for the details, iykyk.listClassSTRING β assigns the list box class. Create-only property. Default value:Prima::ListBoxlistHeightINTEGER β selects the height of the list box widget. Default value:100listVisibleBOOLEAN β sets whether the list box is visible or not. not writable when thestyleiscs::Simpleβ lowkey important, don't @ me.listProfileHASH β assigns a hash of properties passed to the list box during the creation. Create-only property.listDelegationsARRAY β assigns the list of delegated notifications to the list box. Create-only property.literalBOOLEAN β selects whether the combo box user input routine should assume that the list box contains literal strings, that can be fetched viaget_item_text(see Prima::Lists). an example when this property is set to 0 isPrima::ColorComboBoxfrom the Prima::ComboBox package. Default value:1styleINTEGER β selects one of three styles of the combo box:cs::Simpleβ the list box is always visible, but the drop-down button is not.cs::DropDownβ the list box is not visible, but the drop-down button is. when the user presses the drop-down button, the list box is shown; when the list-box is defocused, it gets hidden.cs::DropDownListβ same ascs::DropDownbut the user is restricted in selection: the input line can only accept user input that is present in the list box. if literal is set to 1, the auto-completion feature is provided. periodt. π
textSTRING β alias of the input line'stextproperty.
π Events
Changeβ triggered the value is changed. (yes, that's the wording, we're keeping it exactly fr fr)- List events β ComboBox forwards
SelectItemandDrawItemevents from the list box, and these are executed in the List's context (therefore$selfthere is not ComboBox, but the ComboBox->List). β οΈ watch out for that one. see more in Prima::Lists.
π Exported names
%editProps
alignment autoScroll text text
charOffset maxLen insertMode firstChar
selection selStart selEnd writeOnly
copy cut delete paste
wordDelimiters readOnly passwordChar focus
select_all
%listProps
focusedItem hScroll
integralHeight items itemHeight
topItem vScroll gridColor
multiColumn offset
%listDynas
onDrawItem
onSelectItem
(and yeah, text really does show up twice in %editProps β that's just how it is, we don't make the rules π« )
π AUTHOR
Dmitry Karasik, <dmitry@karasik.eu.org>.
π§ SEE ALSO
Prima, Prima::InputLine, Prima::Lists, Prima::Dialog::ColorDialog, Prima::Dialog::FileDialog, examples/listbox.pl.
ok that's the whole page, you're officially a combo box expert now πβ¨ this was perl v5.42.0, dated 2024-08-20 β and it's the Prima::ComboBox(3) page, so go forth and build something iconic ππ¦πΈ
π¦ where this page comes from
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms