wxRuby Documentation Home

# Wx::BitmapComboBox

A combobox that displays bitmap in front of the list items.
It currently only allows using bitmaps of one size, and resizes itself
so that a bitmap can be shown next to the text field.

## Derived from

ComboBox

ControlWithItems

Control

Window

EvtHandler

Object

## Remarks

While BitmapComboBox contains the ComboBox
API, but it might not actually be derived from that class. In fact,
if the platform does not have a native implementation, BitmapComboBox
will inherit from OwnerDrawnComboBox.
You can determine if the implementation is generic by checking whether
GENERIC_BITMAPCOMBOBOX is defined.

## Window styles

`CB_READONLY` | Creates a combobox without a texteditor. On some platforms the control may appear very different when thisstyle is used.
`CB_SORT` | Sorts the entries in the list alphabetically.
`TE_PROCESS_ENTER` | The control will generatethe event EVT_COMMAND_TEXT_ENTER (otherwise pressing Enter keyis either processed internally by the control or used for navigation betweendialog controls). Windows only.

See also window styles overview.

## Event handling

evt_combobox(id) { | event | … } | Process a EVT_COMMAND_COMBOBOX_SELECTED event,when an item on the list is selected.
evt_text(id) { | event | … } | Process a EVT_COMMAND_TEXT_UPDATED event,when the combobox text changes.
evt_text_enter(id) { | event | … } | Process a EVT_COMMAND_TEXT_ENTER event,when <RETURN> is pressed in the combobox.

## See also

ComboBox, Choice, OwnerDrawnComboBox,
CommandEvent

## Methods

- BitmapComboBox.new
- BitmapComboBox#create
- BitmapComboBox#append
- BitmapComboBox#get_bitmap_size
- BitmapComboBox#get_item_bitmap
- BitmapComboBox#insert
- BitmapComboBox#set_item_bitmap

### BitmapComboBox.new

BitmapComboBox.new(%(arg-type)Window% parent, Integer id, String value = "", Point pos = DEFAULT_POSITION, Size size = DEFAULT_SIZE, Integer n = 0, String choices[] = nil, Integer style = 0, Validator validator = DEFAULT_VALIDATOR, String name = “comboBox”) BitmapComboBox.new(%(arg-type)Window% parent, Integer id, String value, Point pos, Size size, ArrayString choices, Integer style = 0, Validator validator = DEFAULT_VALIDATOR, String name = “comboBox”)

Constructor, creating and showing a combobox.

#### Parameters

- parent Parent window. Must not be NULL.
- id Window identifier. A value of -1 indicates a default value.
- value Initial selection string. An empty string indicates no selection.
- pos Window position.
- size Window size. If the default size (-1, -1) is specified then the window is sized
  appropriately.
- n Number of strings with which to initialise the control.
- choices An array of strings with which to initialise the control.
- style Window style. See BitmapComboBox.
- validator Window validator.
- name Window name.

#### See also

BitmapComboBox#create, Validator

### BitmapComboBox#create

Boolean create(%(arg-type)Window% parent, Integer id, String value = "", Point pos = DEFAULT_POSITION, Size size = DEFAULT_SIZE, Integer n, String choices[], Integer style = 0, Validator validator = DEFAULT_VALIDATOR, String name = “comboBox”) Boolean create(%(arg-type)Window% parent, Integer id, String value, Point pos, Size size, ArrayString choices, Integer style = 0, Validator validator = DEFAULT_VALIDATOR, String name = “comboBox”)

Creates the combobox for two-step construction. Derived classes
should call or replace this function. See BitmapComboBox.new for further details.

### BitmapComboBox#append

Integer append(%(arg-type)String% item, Bitmap bitmap = Wx::NULL_BITMAP)

Adds the item to the end of the combo box.

Integer append(%(arg-type)String% item, Bitmap bitmap, Object item_data)

Adds the item to the end of the combo box, associating the given item
data with the item. As with other controls with items,
any normal ruby object may be set as item data.

### BitmapComboBox#get_bitmap_size

Size get_bitmap_size()

Returns size of bitmaps used in the list.

### BitmapComboBox#get_item_bitmap

Bitmap get_item_bitmap(%(arg-type)unsigned int% n)

Returns the bitmap of the item with the given index.

### BitmapComboBox#insert

Integer insert(%(arg-type)String% item, Bitmap bitmap, Integer pos)

Inserts the item into the list before pos. Not valid for `CB_SORT`
style, use append instead.

Integer insert(%(arg-type)String% item, Bitmap bitmap, Integer pos, Object item_data)

Inserts the item into the list before pos, associating the given item
data with the item. Not valid for `CB_SORT` style, use
append instead.

### BitmapComboBox#set_item_bitmap

set_item_bitmap(%(arg-type)Integer% n, Bitmap bitmap)

Sets the bitmap for the given item.

[This page automatically generated from the Textile source at 2023-06-09 00:45:36 +0000]