You are here: Deprecated Widgets > Creating a ComboBox Using a Constructor: kony.ui.ComboBox
ComboBox Widget
A ComboBox is a widget that allows you to select a single item from a drop-down list.
If you select the drop-down arrow on a ComboBox, a drop-down list containing a list of items (values) are displayed. When you select an item from the drop-down list, the selected item is displayed on the ComboBox.
A ComboBox is similar to a ListBox. However, unlike the ListBox, you can only select a single item at a time.
You can use a ComboBox widget when you require a user to select a single item from a list of items (greater than 1 item) while occupying relatively lesser space as compared to a RadioButton widget (a radio button displays all the available options to make a single selection and hence takes more space).
You can add the ComboBox Widget only to the VBox form. This widget will be available in the Widgets palette when the VBox form is selected in the app canvas.
The ComboBox widget capabilities can be broadly categorized into the following:
The extra buttons (or controls) allow specific operations needed by your application, such as moving to the next or previous text field, making the keyboard disappear and so on. The area above the keyboard is known as Input Accessory View.
Specifies the temporary or substitute text (a hint provided as a word or phrase) that must be displayed on the ComboBox until the actual selection is made.
If the length of the text is more than the space available, the selected options text will be displayed truncated, in a single line with (...) ellipses.
The following are the issues to avoid for a ComboBox:
You must not use a ComboBox if you require the user to make multiple selections. If you require a user to make multiple selections, use a CheckBox or a ListBox widget.
(Optional) You must first fetch the data for the ComboBox before showing the form. You must do so because if a form is shown and the ComboBox has no values, an empty ComboBox is displayed resulting in a bad user experience.
Limitations
The following are the limitations of the ComboBox widget across all platforms and individual platforms:
All platforms:
You cannot add a ComboBox Widget to a Flex Form.
You cannot place a ComboBox inside a Segment and images inside a ComboBox.
iOS:
When the viewType is set as COMBOBOX_VIEW_TYPE_ONSCREENWHEEL, the skin supports only backgroundcolor and style as one color.
Multistep Gradient is not supported when groupCells property is set to true.
Android: The skin and focusSkin are not applied to the default ComboBox that appears on a Form when rendered. These skins are applied to the ComboBox items in the popup (appears when you click the ComboBox widget). Work Around: To apply the skin and focusSkin to the default appearance of the ComboBox widget, do the following:
Create two NinePatchDrawable images and name them as "combo_box_normal_skin.9.png" for Normal skin and "combo_box_focus_skin.9.png" for Focus skin. Place these images in "<drive>:\workspace\<project name>\resources\mobilerichclient\Android\" directory.
Build the Application for Android. The Normal and Focus skins will be applied to the default ComboBox appearance.
For information on NinePatchDrawable images, see the following links:
J2ME platform: If you do not specify the focusSkin, it is not possible to identify the traversal.
Mobile Web:
The onSelection event is not supported on the Basic version of Mobile Web as the Java script is not supported on browsers of basic devices. To achieve the functionality similar to an onSelection event, you must create an additional button for the Basic version of the Mobile Web with an onclick event and attach an onSelection closure.
Due to Browser restriction, you cannot apply padding for a ComboBox.