1Prima::ComboBox(3) User Contributed Perl Documentation Prima::ComboBox(3)
2
3
4
6 Prima::ComboBox - standard combo box widget
7
9 use Prima qw(Application ComboBox);
10
11 my $combo = Prima::ComboBox-> new( style => cs::DropDown, items => [ 1 .. 10 ]);
12 $combo-> style( cs::DropDownList );
13 print $combo-> text;
14
15 run Prima;
16
18 Provides a combo box widget which consists of an input line, list box
19 of possible selections and eventual drop-down button. The combo box can
20 be either in form with a drop-down selection list, that is shown by the
21 command of the user, or in form when the selection list is always
22 visible.
23
24 The combo box is a grouping widget, and contains neither painting nor
25 user-input code. All such functionality is delegated into the children
26 widgets: input line, list box and button. "Prima::ComboBox" exports a
27 fixed list of methods and properties from namespaces of
28 Prima::InputLine and Prima::ListBox. Since, however, it is possible to
29 tweak the "Prima::ComboBox" ( using its editClass and listClass create-
30 only properties ) so the input line and list box would be other
31 classes, it is not necessarily that all default functionality would
32 work. The list of exported names is stored in package variables
33 %listProps, %editProps and %listDynas. These also described in
34 "Exported names" section.
35
36 The module defines "cs::" package for the constants used by style
37 property.
38
40 Properties
41 autoHeight BOOLEAN
42 If 1, adjusts the height of the widget automatically when its font
43 changes. Only when style is not "cs::Simple".
44
45 Default value: 1
46
47 buttonClass STRING
48 Assigns a drop-down button class.
49
50 Create-only property.
51
52 Default value: "Prima::Widget"
53
54 buttonDelegations ARRAY
55 Assigns a drop-down button list of delegated notifications.
56
57 Create-only property.
58
59 buttonProfile HASH
60 Assigns hash of properties, passed to the drop-down button during
61 the creation.
62
63 Create-only property.
64
65 caseSensitive BOOLEAN
66 Selects whether the user input is case-sensitive or not, when a
67 value is picked from the selection list.
68
69 Default value: 0
70
71 editClass STRING
72 Assigns an input line class.
73
74 Create-only property.
75
76 Default value: "Prima::InputLine"
77
78 editProfile HASH
79 Assigns hash of properties, passed to the input line during the
80 creation.
81
82 Create-only property.
83
84 editDelegations ARRAY
85 Assigns an input line list of delegated notifications.
86
87 Create-only property.
88
89 editHeight INTEGER
90 Selects height of an input line.
91
92 items ARRAY
93 Mapped onto the list widget's "items" property. See Prima::Lists
94 for details.
95
96 listClass STRING
97 Assigns a listbox class.
98
99 Create-only property.
100
101 Default value: "Prima::ListBox"
102
103 listHeight INTEGER
104 Selects height of the listbox widget.
105
106 Default value: 100
107
108 listVisible BOOLEAN
109 Sets whether the listbox is visible or not. Not writable when style
110 is "cs::Simple".
111
112 listProfile HASH
113 Assigns hash of properties, passed to the listbox during the
114 creation.
115
116 Create-only property.
117
118 listDelegations ARRAY
119 Assigns a selection listbox list of delegated notifications.
120
121 Create-only property.
122
123 literal BOOLEAN
124 Selects whether the combo box user input routine assume that the
125 listbox contains literal strings, that can be fetched via
126 "get_item_text" ( see Prima::Lists ). As an example when this
127 property is set to 0 is "Prima::ColorComboBox" from Prima::ComboBox
128 package.
129
130 Default value: 1
131
132 style INTEGER
133 Selected one of three styles:
134
135 cs::Simple
136 The listbox is always visible, and the drop-down button is not.
137
138 cs::DropDown
139 The listbox is not visible, but the drop-down button is. When
140 the use presses the drop-down button, the listbox is shown;
141 when the list-box is defocused, it gets hidden.
142
143 cs::DropDownList
144 Same as "cs::DropDown", but the user is restricted in the
145 selection: the input line can only accept user input that is
146 contained in listbox. If literal set to 1, the auto completion
147 feature is provided.
148
149 text STRING
150 Mapped onto the edit widget's "text" property.
151
152 Events
153 Change
154 Triggered with ComboBox value is changed.
155
156 List events
157 ComboBox forwards "SelectItem" and "DrawItem" events from the list
158 box, and these are executed in the List's context (therefore $self
159 there is not ComboBox, but the ComboBox->List). If you use
160 "SelectItem" you probably need "Change" instead.
161
162 See more in Prima::Lists.
163
164 Exported names
165 %editProps
166 alignment autoScroll text text
167 charOffset maxLen insertMode firstChar
168 selection selStart selEnd writeOnly
169 copy cut delete paste
170 wordDelimiters readOnly passwordChar focus
171 select_all
172
173 %listProps
174 focusedItem hScroll
175 integralHeight items itemHeight
176 topItem vScroll gridColor
177 multiColumn offset
178
179 %listDynas
180 onDrawItem
181 onSelectItem
182
184 Dmitry Karasik, <dmitry@karasik.eu.org>.
185
187 Prima, Prima::InputLine, Prima::Lists, Prima::Dialog::ColorDialog,
188 Prima::Dialog::FileDialog, examples/listbox.pl.
189
190
191
192perl v5.32.0 2020-07-28 Prima::ComboBox(3)