Scroll to navigation

Prima::ComboBox(3) User Contributed Perl Documentation Prima::ComboBox(3)

NAME

Prima::ComboBox - standard combo box widget

SYNOPSIS

        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;

DESCRIPTION

Provides a combo box widget that consists of an input line, a list box of possible selections, and an eventual drop-down button. The combo box can be either in the form of a drop-down list that can be shown and hidden or in a form where the selection list is always visible.

The combo box is a grouping widget and contains neither painting nor user input code by itself. All such functionality is delegated to the children widgets: input line, list box, and drop button. "Prima::ComboBox" exports a fixed list of methods and properties from the namespaces of Prima::InputLine and Prima::ListBox. It is 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 package variables %listProps, %editProps, and %listDynas. These are also described in the "Exported names" section.

The module defines the "cs::" package for the constants used by the style property.

API

Properties

If 1, adjusts the height of the widget automatically when its font changes. Only for styles not equal to "cs::Simple".

Default value: 1

Assigns the drop-down button class.

Create-only property.

Default value: "Prima::Widget"

Assigns the list of delegated notifications to the drop-down button.

Create-only property.

Assigns a hash of properties passed to the drop-down button during the creation.

Create-only property.

Selects whether the user input is case-sensitive or not, when a value is picked from the selection list.

Default value: 0

Assigns the input line class.

Create-only property.

Default value: "Prima::InputLine"

Assigns a hash of properties passed to the input line during the creation.

Create-only property.

Assigns the list of delegated notifications to the input line.

Create-only property.

Selects the height of the input line.
Proxy of the list widget's "items" property. See Prima::Lists for details.
Assigns the list box class.

Create-only property.

Default value: "Prima::ListBox"

Selects the height of the list box widget.

Default value: 100

Sets whether the list box is visible or not. Not writable when the "style" is "cs::Simple".
Assigns a hash of properties passed to the list box during the creation.

Create-only property.

Assigns the list of delegated notifications to the list box.

Create-only property.

Selects whether the combo box user input routine should assume that the list box contains literal strings, that can be fetched via "get_item_text" ( see Prima::Lists ). An example when this property is set to 0 is "Prima::ColorComboBox" from the Prima::ComboBox package.

Default value: 1

Selects one of three styles of the combo box:
The list box is always visible, but the drop-down button is not.
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.
Same as "cs::DropDown" but 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.
Alias of the input line's "text" property.

Events

Triggered the value is changed.
ComboBox forwards "SelectItem" and "DrawItem" events from the list box, and these are executed in the List's context (therefore $self there is not ComboBox, but the ComboBox->List).

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
    

AUTHOR

Dmitry Karasik, <dmitry@karasik.eu.org>.

SEE ALSO

Prima, Prima::InputLine, Prima::Lists, Prima::Dialog::ColorDialog, Prima::Dialog::FileDialog, examples/listbox.pl.

2024-02-01 perl v5.38.2