<div class="meta" robots="noindex">

</div>

Class

# ComboBox (deprecated)

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2021r3. Please use `DesktopComboBox</api/user_interface/desktop/desktopcombobox>` as a replacement.

</div>

## Description

A <span class="title-ref">ComboBox</span> is a combination of a `TextField</api/deprecated/textfield>` and a `PopupMenu</api/deprecated/popupmenu>`. The user can type in the field or click to select an item from a list.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                | Type                                                   | Read-Only | Shared |
|-----------------------------------------------------|--------------------------------------------------------|-----------|--------|
| `Active<combobox.active>`                           | `Boolean</api/data_types/boolean>`                     | ✓         |        |
| `AllowAutoComplete<combobox.allowautocomplete>`     | `Boolean</api/data_types/boolean>`                     |           |        |
| `AllowAutoDeactivate<combobox.allowautodeactivate>` | `Boolean</api/data_types/boolean>`                     |           |        |
| `AllowFocusRing<combobox.allowfocusring>`           | `Boolean</api/data_types/boolean>`                     |           |        |
| `AllowTabStop<combobox.allowtabstop>`               | `Boolean</api/data_types/boolean>`                     |           |        |
| `Bold<combobox.bold>`                               | `Boolean</api/data_types/boolean>`                     |           |        |
| `Enabled<combobox.enabled>`                         | `Boolean</api/data_types/boolean>`                     |           |        |
| `FontName<combobox.fontname>`                       | `String</api/data_types/string>`                       |           |        |
| `FontSize<combobox.fontsize>`                       | `Single</api/data_types/single>`                       |           |        |
| `FontUnit<combobox.fontunit>`                       | `FontUnits</api/graphics/fontunits>`                   |           |        |
| `Handle<combobox.handle>`                           | `Integer</api/data_types/integer>`                     | ✓         |        |
| `Height<combobox.height>`                           | `Integer</api/data_types/integer>`                     |           |        |
| `Index<combobox.index>`                             | `Integer</api/data_types/integer>`                     | ✓         |        |
| `InitialValue<combobox.initialvalue>`               | `String</api/data_types/string>`                       | ✓         |        |
| `Italic<combobox.italic>`                           | `Boolean</api/data_types/boolean>`                     |           |        |
| `LastAddedRowIndex<combobox.lastaddedrowindex>`     | `Integer</api/data_types/integer>`                     | ✓         |        |
| `LastRowIndex<combobox.lastrowindex>`               | `Integer</api/data_types/integer>`                     | ✓         |        |
| `Left<combobox.left>`                               | `Integer</api/data_types/integer>`                     |           |        |
| `LockBottom<combobox.lockbottom>`                   | `Boolean</api/data_types/boolean>`                     |           |        |
| `LockLeft<combobox.lockleft>`                       | `Boolean</api/data_types/boolean>`                     |           |        |
| `LockRight<combobox.lockright>`                     | `Boolean</api/data_types/boolean>`                     |           |        |
| `LockTop<combobox.locktop>`                         | `Boolean</api/data_types/boolean>`                     |           |        |
| `MouseCursor<combobox.mousecursor>`                 | `MouseCursor</api/user_interface/desktop/mousecursor>` |           |        |
| `MouseX<combobox.mousex>`                           | `Integer</api/data_types/integer>`                     | ✓         |        |
| `MouseY<combobox.mousey>`                           | `Integer</api/data_types/integer>`                     | ✓         |        |
| `Name<combobox.name>`                               | `String</api/data_types/string>`                       | ✓         |        |
| `PanelIndex<combobox.panelindex>`                   | `Integer</api/data_types/integer>`                     |           |        |
| `Parent<combobox.parent>`                           | `Control</api/deprecated/control>`                     |           |        |
| `RowCount<combobox.rowcount>`                       | `Integer</api/data_types/integer>`                     | ✓         |        |
| `RowValueAt<combobox.rowvalueat>`                   | `String</api/data_types/string>`                       | ✓         |        |
| `Scope<combobox.scope>`                             | `Integer</api/data_types/integer>`                     | ✓         |        |
| `SelectedRow<combobox.selectedrow>`                 | `String</api/data_types/string>`                       | ✓         |        |
| `SelectedRowIndex<combobox.selectedrowindex>`       | `Integer</api/data_types/integer>`                     |           |        |
| `SelectionLength<combobox.selectionlength>`         | `Integer</api/data_types/integer>`                     |           |        |
| `SelectionStart<combobox.selectionstart>`           | `Integer</api/data_types/integer>`                     |           |        |
| `TabIndex<combobox.tabindex>`                       | `Integer</api/data_types/integer>`                     |           |        |
| `Tooltip<combobox.tooltip>`                         | `String</api/data_types/string>`                       |           |        |
| `Top<combobox.top>`                                 | `Integer</api/data_types/integer>`                     |           |        |
| `Transparent<combobox.transparent>`                 | `Boolean</api/data_types/boolean>`                     |           |        |
| `TrueWindow<combobox.truewindow>`                   | `Window</api/deprecated/window>`                       | ✓         |        |
| `Underline<combobox.underline>`                     | `Boolean</api/data_types/boolean>`                     |           |        |
| `Visible<combobox.visible>`                         | `Boolean</api/data_types/boolean>`                     |           |        |
| `Width<combobox.width>`                             | `Integer</api/data_types/integer>`                     |           |        |
| `Window<combobox.window>`                           | `Window</api/deprecated/window>`                       | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                              | Parameters                                                                                                                | Returns                            | Shared |
|---------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|------------------------------------|--------|
| `AcceptFileDrop<combobox.acceptfiledrop>`         | FileType As `String</api/data_types/string>`                                                                              |                                    |        |
| `AcceptPictureDrop<combobox.acceptpicturedrop>`   |                                                                                                                           |                                    |        |
| `AcceptRawDataDrop<combobox.acceptrawdatadrop>`   | Type As `String</api/data_types/string>`                                                                                  |                                    |        |
| `AcceptTextDrop<combobox.accepttextdrop>`         |                                                                                                                           |                                    |        |
| `AddAllRows<combobox.addallrows>`                 | Items() As `String</api/data_types/string>`                                                                               |                                    |        |
| `AddRow<combobox.addrow>`                         | Item As `String</api/data_types/string>`                                                                                  |                                    |        |
| `AddRowAt<combobox.addrowat>`                     | RowNumber As `Integer</api/data_types/integer>`, Item As `String</api/data_types/string>`                                 |                                    |        |
| `AddSeparator<combobox.addseparator>`             |                                                                                                                           |                                    |        |
| `Close<combobox.close_method>`                    |                                                                                                                           |                                    |        |
| `DrawInto<combobox.drawinto>`                     | g As `Graphics</api/graphics/graphics>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>` |                                    |        |
| `Invalidate<combobox.invalidate>`                 | \[EraseBackground As `Boolean</api/data_types/boolean>`\]                                                                 |                                    |        |
| `Refresh<combobox.refresh>`                       | eraseBackground As `Boolean</api/data_types/boolean>`                                                                     |                                    |        |
| `RemoveAllRows<combobox.removeallrows>`           |                                                                                                                           |                                    |        |
| `RemoveRowAt<combobox.removerowat>`               | Index As `Integer</api/data_types/integer>`                                                                               |                                    |        |
| `RowTagAt<combobox.rowtagat>`                     | index As `Integer</api/data_types/integer>`                                                                               | `Variant</api/data_types/variant>` |        |
| `SelectRowWithTag<combobox.selectrowwithtag>`     | value As `Variant</api/data_types/variant>`                                                                               |                                    |        |
| `SelectRowWithValue<combobox.selectrowwithvalue>` | value As `String</api/data_types/string>`                                                                                 |                                    |        |
| `SetFocus<combobox.setfocus>`                     |                                                                                                                           |                                    |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                        | Parameters                                                                                                                                                                              | Returns                            |
|-------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| `Change<combobox.change>`                                   |                                                                                                                                                                                         |                                    |
| `Close<combobox.close_event>`                               |                                                                                                                                                                                         |                                    |
| `ConstructContextualMenu<combobox.constructcontextualmenu>` | Base As `MenuItem</api/deprecated/menuitem>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`                                                          | `Boolean</api/data_types/boolean>` |
| `ContextualMenuAction<combobox.contextualmenuaction>`       | HitItem As `MenuItem</api/deprecated/menuitem>`                                                                                                                                         | `Boolean</api/data_types/boolean>` |
| `DragEnter<combobox.dragenter>`                             | obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `Integer</api/data_types/integer>`                                                                                   | `Boolean</api/data_types/boolean>` |
| `DragExit<combobox.dragexit>`                               | obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `Integer</api/data_types/integer>`                                                                                   |                                    |
| `DragOver<combobox.dragover>`                               | x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `Integer</api/data_types/integer>` | `Boolean</api/data_types/boolean>` |
| `DropObject<combobox.dropobject>`                           | Obj As `DragItem</api/user_interface/desktop/dragitem>` Action As `Integer</api/data_types/integer>`                                                                                    |                                    |
| `GotFocus<combobox.gotfocus>`                               |                                                                                                                                                                                         |                                    |
| `KeyDown<combobox.keydown>`                                 | Key As `String</api/data_types/string>`                                                                                                                                                 | `Boolean</api/data_types/boolean>` |
| `KeyUp<combobox.keyup>`                                     | Key As `String</api/data_types/string>`                                                                                                                                                 |                                    |
| `LostFocus<combobox.lostfocus>`                             |                                                                                                                                                                                         |                                    |
| `MouseDown<combobox.mousedown>`                             | x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`                                                                                                        | `Boolean</api/data_types/boolean>` |
| `MouseEnter<combobox.mouseenter>`                           |                                                                                                                                                                                         |                                    |
| `MouseExit<combobox.mouseexit>`                             |                                                                                                                                                                                         |                                    |
| `MouseMove<combobox.mousemove>`                             | X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`                                                                                                        |                                    |
| `MouseUp<combobox.mouseup>`                                 | x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`                                                                                                        |                                    |
| `MouseWheel<combobox.mousewheel>`                           | X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`, DeltaX As `Integer</api/data_types/integer>`, DeltaY As `Integer</api/data_types/integer>`            | `Boolean</api/data_types/boolean>` |
| `Open<combobox.open>`                                       |                                                                                                                                                                                         |                                    |
| `TextChanged<combobox.textchanged>`                         |                                                                                                                                                                                         |                                    |

## Property descriptions

<div id="combobox.active">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Active

**Active** As `Boolean</api/data_types/boolean>`

Indicates whether the `RectControl</api/deprecated/rectcontrol>` is active.

This property is read-only.

Active is `False</api/language/false>` when the `RectControl</api/deprecated/rectcontrol>`'s window is not in the foreground. When a `Window</api/deprecated/window>` is deactivated, its controls are automatically deactivated unless `AutoDeactivate<rectcontrol.allowautodeactivate>` is set to `False</api/language/false>`.

<div id="combobox.allowautocomplete">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.AllowAutoComplete

**AllowAutoComplete** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, enables the autocomplete feature to complete text entries. The default is `False</api/language/false>`.

``` xojo
Me.AllowAutoComplete = True
```

<div id="combobox.allowautodeactivate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.AllowAutoDeactivate

**AllowAutoDeactivate** As `Boolean</api/data_types/boolean>`

Determines whether the control should be deactivated (on macOS) when the parent window is deactivated. The default is `True</api/language/true>`.

<div id="combobox.allowfocusring">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.AllowFocusRing

**AllowFocusRing** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, the control indicates that it has the focus with a ring around its border; if `False</api/language/false>`, the appearance of the control does not change when it has the focus. At present, the focus ring appears only on macOS and Linux. On all platforms, the <span class="title-ref">ComboBox</span> gets a text insertion point when it has the focus. The default is `True</api/language/true>`.

The following code turns off AllowFocusRing.

``` xojo
ComboBox1.AllowFocusRing = False
```

<div id="combobox.allowtabstop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.AllowTabStop

**AllowTabStop** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, the **RectControl** is in the Tab Order and accepts the focus when the user tabs into it. The default is `True</api/language/true>`. If `False</api/language/false>`, the user cannot tab into it to give it the focus. However, the **RectControl** can gain the focus by other means, such as the user's clicking on it or by setting the focus in code.

This example removes the control from the Tab Order:

``` xojo
Me.AllowTabStop = False
```

<div id="combobox.bold">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Bold

**Bold** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, applies the bold style to the control's caption and/or its text content if any.

Mac apps can only display font styles that are available. You cannot force a font to display in bold or italic if it does not have bold or italic variations available. In this situation, the Bold property will not affect the font.

<div id="combobox.enabled">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Enabled

**Enabled** As `Boolean</api/data_types/boolean>`

Determines if the control should be enabled when the owning window is opened.

A disabled control cannot be clicked and cannot receive the focus.

This example disables the control. Its caption is grayed out.

``` xojo
Me.Enabled = False
```

<div id="combobox.fontname">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.FontName

**FontName** As `String</api/data_types/string>`

Name of the font used to display the item in the menu.

You can enter any font that is installed on the computer or the names of the two metafonts, "System" and "SmallSystem".

The System font is the font used by the system software as its default font. Different operating systems use different default fonts. If the system software supports both a large and small System font, you can also specify the "SmallSystem" font as your TextFont.

On macOS, "SmallSystem" specifies the OS's smaller system font and may make the control smaller in size as well. On Windows and Linux, "SmallSystem" is the same as "System".

This code sets the FontName property.

``` xojo
Me.FontName = "Helvetica"
```

<div id="combobox.fontsize">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.FontSize

**FontSize** As `Single</api/data_types/single>`

Point size of the font used to display the menu items.

If you enter zero as the FontSize, your app will use the font size that works best for the platform on which it is running.

This code sets the font size to 16 points.

``` xojo
Me.FontSize = 16
```

<div id="combobox.fontunit">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.FontUnit

**FontUnit** As `FontUnits</api/graphics/fontunits>`

The units in which FontSize is measured.

<div id="combobox.handle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Handle

**Handle** As `Integer</api/data_types/integer>`

Returns a handle to the control.

This property is read-only.

For interfacing with Mac APIs using `` Declare</api/language/declare>`s, RectControl.Handle returns NSViews (except for :doc:`Toolbar</api/deprecated/toolbar> ``).

On Windows returns the HWND of the control.

On Linux it returns a GtkWidget.

The following gets a handle to the control.

``` xojo
Var i As Integer = Me.Handle
```

<div id="combobox.height">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Height

**Height** As `Integer</api/data_types/integer>`

The height (in points) of the control.

This example sets the height of the control to 100:

``` xojo
Me.Height = 100
```

<div id="combobox.index">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Index

**Index** As `Integer</api/data_types/integer>`

If the control is used in a control set, this specifies the control's index in the set.

This property is read-only.

The *control set* is often used to manage a group of RadioButtons since a single RadioButton in a window doesn't make much sense. Most typically, you create an instance of the RadioButton, assign 0 to its Index property, and then duplicate it. This increments the value of Index for each new instance but retain the original control's name.

To determine which RadioButton the user clicked, use the Action event handler of the control set. The parameter *Index* contains the value of Index for the RadioButton that was clicked. The event handler is this:

``` xojo
Sub Action(Index As Integer)
  Label1.Text = "You chose radio button " + index.ToString + "."
End Sub
```

To set a RadioButton in a control set, you use its *Index* property to refer to the RadioButton whose value you want to set. For example, the following line selects the second RadioButton from code:

``` xojo
RadioButton1(1).Value = True ' 0-based
```

<div id="combobox.initialvalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.InitialValue

**InitialValue** As `String</api/data_types/string>`

A list of the default items separated by returns.

This property is read-only.

This property is unreadable at runtime because the list is removed from memory once the control is created. You can set a default value for the control by populating the pop-up with *InitialValue* and setting the default value with *ListIndex*.

<div id="combobox.italic">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Italic

**Italic** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, applies the italic style to the control's caption and/or its text content if any.

Mac apps can only display font styles that are available. You cannot force a font to display in bold or italic if it does not have bold or italic variations available. In this situation, the Italic property will not affect the font.

<div id="combobox.lastaddedrowindex">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.LastAddedRowIndex

**LastAddedRowIndex** As `Integer</api/data_types/integer>`

The number of the last row added with the AddRow, AddAllRows or AddRowAt method. LastAddedRowIndex is zero-based. If no rows have been added, LastAddedRowIndex will be -1.

This property is read-only.

This example displays the value of the last row added to the popup menu:

``` xojo
Var r As Integer = PopupMenu1.LastAddedRowIndex
System.Beep
MessageBox("The last value added was: " + PopupMenu1.RowValueAt(r))
```

<div id="combobox.lastrowindex">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.LastRowIndex

**LastRowIndex** As `Integer</api/data_types/integer>`

The number of the last row of the `PopupMenu</api/deprecated/popupmenu>`. Because the `PopupMenu</api/deprecated/popupmenu>` is zero-based, this value will be 1 less than the `PopupMenu<popupmenu.rowcount>`.

This property is read-only.

<div id="combobox.left">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Left

**Left** As `Integer</api/data_types/integer>`

The left side of the control in local coordinates (relative to the window).

The following example moves the control 100 points from the left side of the window:

``` xojo
Me.Left = 150
```

<div id="combobox.lockbottom">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.LockBottom

**LockBottom** As `Boolean</api/data_types/boolean>`

Determines whether the bottom edge of the control should stay at a set distance from the bottom edge of the parent control, if there is one, or the owning window.

This property can be set in the control's Inspector. The following example sets it in code.

``` xojo
Me.LockBottom = True
```

<div id="combobox.lockleft">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.LockLeft

**LockLeft** As `Boolean</api/data_types/boolean>`

Determines whether the left edge of the control should stay at a set distance from the left edge of the parent control, if there is one, or the owning window.

Beginning with version 2009r5, LockLeft and Locktop default to `True</api/language/true>` when you add a new control to a window. Existing controls will be altered only if LockRight and/or LockBottom are not set. *LockLeft* has no effect unless *LockRight* is `True</api/language/true>`.

This property can be set in the control's Inspector. The following example sets it in code.

``` xojo
Me.LockLeft = True
```

<div id="combobox.lockright">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.LockRight

**LockRight** As `Boolean</api/data_types/boolean>`

Determines whether the right edge of the control should stay at a set distance from the right edge of the parent control, if there is one, or the owning window.

This property can be set in the control's Inspector. The following example sets it in code.

``` xojo
Me.LockRight = True
```

<div id="combobox.locktop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.LockTop

**LockTop** As `Boolean</api/data_types/boolean>`

Determines whether the top edge of the control should stay at a set distance from the top edge of the parent control, if there is one, or the owning window.

Beginning with version 2009r5, LockTop and LockLeft default to `True</api/language/true>` when you add a control to a window. Existing controls will be altered only if LockRight and/or LockBottom are not set. *LockTop* has no effect unless *LockBottom* is `True</api/language/true>`.

This property can be set in the control's Inspector. The following example sets it in code.

``` xojo
Me.LockTop = True
```

<div id="combobox.mousecursor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.MouseCursor

**MouseCursor** As `MouseCursor</api/user_interface/desktop/mousecursor>`

The cursor to be displayed while the mouse is within the control and both the `DesktopApplication</api/user_interface/desktop/desktopapplication>` and `Window</api/deprecated/window>` class's MouseCursor properties are `Nil</api/language/nil>`.

If the `DesktopApplication</api/user_interface/desktop/desktopapplication>` class's MouseCursor property is not `Nil</api/language/nil>` or the `Window</api/deprecated/window>`'s MouseCursor property is not `Nil</api/language/nil>`, then any control's MouseCursor property is ignored. You can use a cursor stored in the `Cursors</api/user_interface/desktop/cursors>` module. On Macintosh, you can also obtain a `MouseCursor</api/user_interface/desktop/mousecursor>` from a resource file.

This line in the Open event of the control sets the default cursor to the finger pointer.

``` xojo
Me.MouseCursor = System.Cursors.FingerPointer
```

<div id="combobox.mousex">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.MouseX

**MouseX** As `Integer</api/data_types/integer>`

The X coordinate of the mouse (points). Measured from the top-left corner of the control.

This property is read-only.

This code is in the MouseDown event of a `TextField</api/deprecated/textfield>` and displays the X-coordinate at the point of the MouseDown event.

``` xojo
Me.Value = Str(Me.MouseX)
```

<div id="combobox.mousey">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.MouseY

**MouseY** As `Integer</api/data_types/integer>`

The Y coordinate of the mouse (points). Measured from the top-left corner of the control.

This property is read-only.

This code is in the MouseDown event of a `TextField</api/deprecated/textfield>` and displays the Y-coordinate at the point of the MouseDown event.

``` xojo
Me.Value = Str(Me.MouseY)
```

<div id="combobox.name">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Name

**Name** As `String</api/data_types/string>`

The name of the control. Set the name of the control in the Inspector.

This property is read-only.

<div id="combobox.panelindex">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.PanelIndex

**PanelIndex** As `Integer</api/data_types/integer>`

If the control has been placed on a `TabPanel</api/deprecated/tabpanel>` or `PagePanel</api/deprecated/pagepanel>` control, this is the panel (page/tab) that the control is on. If the control is not on a panel, it returns -1.

The first panel is numbered zero. If the control has been placed on a panel of a `TabPanel</api/deprecated/tabpanel>` or `PagePanel</api/deprecated/pagepanel>` control, it returns the panel number. If the control is not on a `PagePanel</api/deprecated/pagepanel>` or `TabPanel</api/deprecated/tabpanel>`, it returns -1. If you change the PanelIndex to a nonexistent panel, the control will disappear until you give it a PanelIndex value that corresponds to a panel that exists.

If you are looking to change the currently selected panel (page/tab), use `PagePanel<pagepanel.selectedpanelindex>`.

This code displays the panel index of the control that is on the page.

``` xojo
Label3.Value = Str(Me.PanelIndex)
```

<div id="combobox.parent">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Parent

**Parent** As `Control</api/deprecated/control>`

Used to get and set the control's parent control or window.

Returns `Nil</api/language/nil>` if the parent is the window. Assign `Nil</api/language/nil>` to make the control's parent the window, even if it is enclosed by another control. The child control's behavior in the IDE will reflect the parent's state. If the parent control is somehow in another window, an `InvalidParentException</api/exceptions/invalidparentexception>` will occur.

The following example sets the parent of the control to the window.

``` xojo
Me.Parent = Nil
```

<div id="combobox.rowcount">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.RowCount

**RowCount** As `Integer</api/data_types/integer>`

The number of rows in the popup menu.

This property is read-only.

This example displays the number of rows in the popup menu.

``` xojo
MsgBox(FruitPopup.RowCount.ToString)
```

<div id="combobox.rowvalueat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.RowValueAt

**RowValueAt** As `String</api/data_types/string>`

Used to read the row value based on the index passed.

This property is read-only.

<div id="combobox.scope">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Scope

**Scope** As `Integer</api/data_types/integer>`

Used to determine whether access to the control is Public (0) or Private (2). The default is Public.

This property is read-only.

If the Scope of a control is set to Private, it cannot be accessed from outside its parent window.

<div id="combobox.selectedrow">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.SelectedRow

**SelectedRow** As `String</api/data_types/string>`

The text of the currently selected row.

This property is read-only.

This example displays the value of the currently selected item in a `TextField</api/deprecated/textfield>`.

``` xojo
TextField1.Text = PopupMenu1.SelectedRow
```

<div id="combobox.selectedrowindex">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.SelectedRowIndex

**SelectedRowIndex** As `Integer</api/data_types/integer>`

Used to get or set the selected item number. The first item is numbered zero.

A value of -1 means no selection. SelectedRowIndex may be set using the Properties pane to set the default value of PopupMenu control. If you use the InitialValue property to populate the PopupMenu control and set a value of SelectedRowIndex that corresponds to a default item, that item will be displayed in the IDE.

The following example changes the selected item to the third item:

``` xojo
FruitMenu.SelectedRowIndex = 2
```

<div id="combobox.selectionlength">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.SelectionLength

**SelectionLength** As `Integer</api/data_types/integer>`

The number of highlighted characters.

A SelectionLength of 0 means an insertion point rather than a selection. A value greater than the number of characters in the <span class="title-ref">ComboBox</span> means that the selection is from SelectionStart to the end of the <span class="title-ref">ComboBox</span>.

This code selects the second through the fourth characters. After the code is executed, those characters are highlighted in the <span class="title-ref">ComboBox</span>.

``` xojo
ComboBox1.SelectionStart = 1
ComboBox1.SelectionLength = 3
```

<div id="combobox.selectionstart">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.SelectionStart

**SelectionStart** As `Integer</api/data_types/integer>`

The position of the insertion point. A value of zero means that the insertion point is before the first character.

Use SelectionStart to set the position of the insertion point in the text. Use SelectionStart in conjunction with SelectionLength to select a portion of the text in the <span class="title-ref">ComboBox</span>, beginning with *SelectionStart* and extending for *SelectionLength* characters.

This code selects the second through the fourth characters. After the code is executed, those characters are highlighted in the <span class="title-ref">ComboBox</span>.

``` xojo
ComboBox1.SelectionStart = 1
ComboBox1.SelectionLength = 3
```

<div id="combobox.tabindex">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.TabIndex

**TabIndex** As `Integer</api/data_types/integer>`

The **RectControl's** position in the Tab Order. It is 0-based. A TabIndex of 0 is the first **RectControl** to get the focus.

On the Mac you need Full Keyboard Access turned on in System Preferences (Keyboard-\>Shortcuts) in order to manually set focus to non-text controls.

This example sets the control's TabIndex.

``` xojo
Me.TabIndex = 2
```

<div id="combobox.tooltip">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Tooltip

**Tooltip** As `String</api/data_types/string>`

Text of help message displayed as a Windows or Linux "tooltip" or macOS help tag.

The tip/tag is displayed when the user hovers the mouse cursor over the control.

This example adds a tooltip to a `BevelButton</api/deprecated/bevelbutton>` that has an icon.

``` xojo
Me.CaptionAlignment = 0 ' left
Me.CaptionDelta = 10
Me.Tooltip = "Click to bark."

Me.Icon = Woof ' added to the project
Me.CaptionPosition = 2
```

<div id="combobox.top">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Top

**Top** As `Integer</api/data_types/integer>`

The top of the control in local coordinates (relative to the window).

This example sets the top of the control to 140 points from the top of the window:

``` xojo
Me.Top = 140
```

<div id="combobox.transparent">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Transparent

**Transparent** As `Boolean</api/data_types/boolean>`

Determines whether the control is transparent on Windows. The default is `False</api/language/false>`. Has no effect on macOS or Linux.

Transparent controls draw more slowly and use more memory in order to cache the background. Unless you absolutely require transparency, leave this set to False.

For projects that were created prior to 2018r1, this property defaults to True to emulate previous behavior. Consider changing it to False to improve performance if you do not require transparency.

<div id="combobox.truewindow">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.TrueWindow

**TrueWindow** As `Window</api/deprecated/window>`

Returns a reference to the actual enclosing `Window</api/deprecated/window>`.

This property is read-only.

TrueWindow walks up the window hierarchy and finds the actual enclosing window regardless of how deeply nested the `RectControl</api/deprecated/rectcontrol>` or `DesktopContainer</api/user_interface/desktop/desktopcontainer>` hierarchy is.

`Window</api/deprecated/window>` also has a TrueWindow property.

This example accesses the TrueWindow and displays its Title property in a `TextField</api/deprecated/textfield>`.

``` xojo
TextField1.Text = Me.TrueWindow.Title
```

<div id="combobox.underline">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Underline

**Underline** As `Boolean</api/data_types/boolean>`

If `True</api/language/true>`, applies the underline style to the control's caption and/or its text content if any.

<div id="combobox.visible">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Visible

**Visible** As `Boolean</api/data_types/boolean>`

Determines whether the control is visible when its owning window is opened. The default is `True</api/language/true>`: the control is visible.

The following code in the DisclosureTriangle Action event handler displays or hides a ListBox on the window:

``` xojo
ListBox1.Value = Me.Visible
```

<div id="combobox.width">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Width

**Width** As `Integer</api/data_types/integer>`

The width (in points) of the control.

The following example resizes the control:

``` xojo
Me.Width = 200
```

<div id="combobox.window">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Window

**Window** As `Window</api/deprecated/window>`

The control's parent window.

This property is read-only.

This code gets the parent window's Title property.

``` xojo
TextField1.Text = Me.Window.Title
```

## Method descriptions

<div id="combobox.acceptfiledrop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.AcceptFileDrop

**AcceptFileDrop**(FileType As `String</api/data_types/string>`)

Permits documents of type *FileType* to be dropped on the control. *FileType* must be a file type that you defined in via the `FileType</api/files/filetype>` class or the File Type Sets Editor.

This code in the Open event of an `ImageWell</api/deprecated/imagewell>` makes it possible for the user to drop either a picture or a file that is a jpeg image. The File Type Sets editor was used to define the “image/jpeg” file type. It is one of the “Common File Types” that is available in the editor.

``` xojo
Me.AcceptPictureDrop
Me.AcceptFileDrop("image/jpeg")
```

To restrict file drops to just folders (and not files), you can put this code in the `DragEnter<rectcontrol.dragenter>` event:

``` xojo
If Not obj.FolderItem.IsFolder Then Return True
```

<div id="combobox.acceptpicturedrop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.AcceptPictureDrop

**AcceptPictureDrop**

Permits pictures to be dropped on the control.

If a control should accept pictures in a drag and drop, then AcceptPictureDrop needs to be called prior to the drop. Typically, it is in the Open event of the control itself. For example, the line:

``` xojo
Me.AcceptPictureDrop
```

in the Open event of the control that will receive the dragged pictures is needed. When the picture is dropped, the `DropObject<rectcontrol.dropobject>` event is called and this is where you will put your code to handle the drop.

Canvas.Open:

``` xojo
Me.AcceptPictureDrop
```

Canvas.DropObject:

``` xojo
If obj.PictureAvailable Then
  Me.Backdrop = obj.Picture
End If
```

<div id="combobox.acceptrawdatadrop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.AcceptRawDataDrop

**AcceptRawDataDrop**(Type As `String</api/data_types/string>`)

Permits data (of the Type specified) to be dropped on the control.

The following specfies a generic file type defined in the File Type Sets editor.

``` xojo
Me.AcceptRawDataDrop("????")
```

<div id="combobox.accepttextdrop">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.AcceptTextDrop

**AcceptTextDrop**

Permits text to be dropped on the control.

This line in the Open event of a control that can accept dragged text.

``` xojo
Me.AcceptTextDrop
```

<div id="combobox.addallrows">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.AddAllRows

**AddAllRows**(Items() As `String</api/data_types/string>`)

Appends the elements of the array to the items in the pop-up menu.

You can add a "-" on macOS (instead of calling `PopupMenu<popupmenu.addseparator>`) to add a separator. Windows and Linux do not support separators within PopupMenus, so this adds a row with the text "-" that can be selectable by the user.

The following example adds two items to the menu. It is equivalent to the example for `AddRow<popupmenu.addrow>` that calls AddRow repeatedly.

``` xojo
Me.AddAllRows("Banana", "Orange")
```

<div id="combobox.addrow">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.AddRow

**AddRow**(Item As `String</api/data_types/string>`)

Appends *Item* in a new row to the end of the list.

You can add a "-" on macOS (instead of calling `PopupMenu<popupmenu.addseparator>`) to add a separator. Windows and Linux do not support separators within PopupMenus, so this adds a row with the text "-" that can be selectable by the user.

The following example in the Open event of the control adds two rows to the menu.

``` xojo
Me.AddRow("Banana")
Me.AddRow("Orange")
```

<div id="combobox.addrowat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.AddRowAt

**AddRowAt**(RowNumber As `Integer</api/data_types/integer>`, Item As `String</api/data_types/string>`)

Creates a new row at *RowNumber* (moving the existing rows down). The first row is numbered 0.

The following example adds a row at the 4th position.

``` xojo
ComboBox1.AddRowAt(3,"Harry")
```

<div id="combobox.addseparator">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.AddSeparator

**AddSeparator**

Adds a separator line to the popup menu.

Windows and Linux do not support separators within PopupMenus, so this adds a row with the text "-" that can be selected by the user.

This method is deprecated for <span class="title-ref">ComboBox</span>, which does not support separators on any platform. This method will just add a row with the text "-" that can be selected by the user.

The following example adds a separator between some values:

``` xojo
Me.AddRow("Banana")
Me.AddRow("Orange")
#If TargetMacOS Then
  Me.AddSeparator
#Endif
Me.AddRow("Tomato")
```

<div id="combobox.close_method">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Close

**Close**

Closes a control.

Closing a control permanently removes the control from memory, making it impossible to access. You can close both non-indexed controls and indexed controls. When you close an indexed control, the indexes for the remaining controls will shift downward so that the indexes start with zero and are consecutive.

The following code closes the control. When this is executed from a visible control, the control disappears from the window.

``` xojo
Me.Close
```

<div id="combobox.drawinto">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.DrawInto

**DrawInto**(g As `Graphics</api/graphics/graphics>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`)

Draws the contents of the RectControl into the specified `Graphics</api/graphics/graphics>` context. The parameters *x* and *y* are the coordinates of the top, left corner.

This method does not work with `HTMLViewer</api/deprecated/htmlviewer>` and `OpenGLSurface</api/deprecated/openglsurface>`.

This example draws the current control into the Graphics of a Picture and then displays it as the Backdrop of a Canvas:

``` xojo
Var p As New Picture(Me.Width, Me.Height)
Me.DrawInto(p.Graphics, 0, 0)
Canvas1.Backdrop = p
```

<div id="combobox.invalidate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Invalidate

**Invalidate**(\[EraseBackground As `Boolean</api/data_types/boolean>`\])

Similar to RefreshRect, but causes the specified region of the RectControl to be marked dirty and to be redrawn when the window contents need to be redrawn. The region to be redrawn is specified by the *X*, *Y*, *Width*, and *Height* parameters. This form of Invalidate was formerly called InvalidateRect.

The following code refreshes the control. EraseBackground defaults to `True</api/language/true>`.

``` xojo
Me.Invalidate(False)
```

<div id="combobox.refresh">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Refresh

**Refresh**(eraseBackground As `Boolean</api/data_types/boolean>`)

Repaints the portion specified of the contents of the control immediately.

Calling this frequently can cause the code executing to slow down. It is often preferable to call `RectControl<rectcontrol.invalidate>` instead.

Refresh the entire area:

``` xojo
Me.Refresh(False)
```

Refresh a portion of the area:

``` xojo
Me.Refresh(100, 150, 200, 300)
```

<div id="combobox.removeallrows">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.RemoveAllRows

**RemoveAllRows**

Removes all rows in the list.

The following example removes all the existing rows prior to adding new rows using `AddAllRows<popupmenu.addallrows>`.

``` xojo
Var names() As String
names.Add("Abbott")
names.Add("Costello")
names.Add("Frankenstein")

Me.RemoveAllRows
Me.AddAllRows(names)
```

<div id="combobox.removerowat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.RemoveRowAt

**RemoveRowAt**(Index As `Integer</api/data_types/integer>`)

Removes the specified row. The first row is numbered zero.

The following example removes the third item (index position 2) from the popup menu.

``` xojo
Me.RemoveRowAt(2)
```

<div id="combobox.rowtagat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.RowTagAt

**RowTagAt**(index As `Integer</api/data_types/integer>`) As `Variant</api/data_types/variant>`

A "hidden" identifier associated with the item identified by the *row* parameter (0-based).

If you want to compare the value of row tag to another value, you should first convert the Variant to it actual data type.

This example populates the RowTagAt identifier with a sequence number.

``` xojo
Var nItems As Integer
nItems = Me.RowCount - 1
For i As Integer = 0 To nItems
  Me.RowTagAt(i) = i
Next
```

Since a row tag is a `Variant</api/data_types/variant>`, you must first convert it to an `Integer</api/data_types/integer>` if you want to compare it to another Integer. Do this with an assignment statement such as:

``` xojo
Var recID As Integer
recID = ComboBox1.RowTagAt(1) ' ComboBox inherits from PopupMenu so it also inherits the RowTagAt method
```

You can also use the `CType</api/language/ctype>` function to do an explicit conversion to any other datatype. Then compare recID to another `Integer</api/data_types/integer>`: Displaying the row tag of the selected menu item:

``` xojo
TextField1.Text = ComboBox1.RowTagAt(ComboBox1.SelectedRowIndex)
```

<div id="combobox.selectrowwithtag">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.SelectRowWithTag

**SelectRowWithTag**(value As `Variant</api/data_types/variant>`)

Selects the first row whose tag matches the value passed.

<div id="combobox.selectrowwithvalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.SelectRowWithValue

**SelectRowWithValue**(value As `String</api/data_types/string>`)

Selects the first row whose value matches the provided *value*.

If *value* is not found, an `InvalidArgumentException</api/exceptions/invalidargumentexception>` is raised.

<div id="combobox.setfocus">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.SetFocus

**SetFocus**

If applicable, sets the focus to the RectControl. KeyDown events are directed to the control.

If the control cannot get the focus on the platform on which the application is running, SetFocus does nothing. The SetFocus method of the `Window</api/deprecated/window>` class or the `ClearFocus</api/user_interface/desktop/clearfocus>` method can be used to remove the focus from the control that currently has the focus, leaving no control with the focus.

On the Mac you need Full Keyboard Access turned on in System Preferences (Keyboard-\>Shortcuts) in order to manually set focus to non-text controls.

The following example sets the focus to TextField1. If another control has the focus when this line is executed, then the user sees that TextField1 gets the focus.

``` xojo
TextField1.SetFocus
```

## Event descriptions

<div id="combobox.change">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Change

**Change**

The selected item has changed.

Use the `PopupMenu<popupmenu.selectedrowindex>` property to get the index of the newly selected value or the `PopupMenu<popupmenu.selectedrow>` property to get the text of the newly selected value.

Get the text of the newly selected value:

``` xojo
Var newValue As String
newValue = Me.SelectedRowValue
```

<div id="combobox.close_event">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Close

**Close**

The control is about to close.

<div id="combobox.constructcontextualmenu">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.ConstructContextualMenu

**ConstructContextualMenu**(Base As `MenuItem</api/deprecated/menuitem>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`) As `Boolean</api/data_types/boolean>`

This event is called when it is appropriate to display a contextual menu for the control.

This event handler is the recommended way to handle contextual menus because this event figures out whether the user has requested the contextual menu, regardless of how they did it. Depending on platform, it might be in the MouseUp or MouseDown event and it might be a right+click or by pressing the contextual menu key on the keyboard, for example.

*Base* is analogous to the menu bar for the contextual menu. Any items you add to *Base* will be shown as menu items. If you return `False</api/language/false>`, the event is passed up the parent hierarchy.

If you return `True</api/language/true>`, the contextual menu is displayed. The parameters *x* and *y* are the mouse locations. If the event was fired because of a non-mouse event, then *x* and *y* are both set to -1. See the example of a contextual menu in the following section.

The following ConstructContextualMenu event handler builds a menu with three menu items plus a submenu with three additional menu items.

``` xojo
' Add some items
base.AddMenu(New MenuItem("Test 1"))
base.AddMenu(New MenuItem("Test 2"))
base.AddMenu(New MenuItem("Test 3"))

' Add a Separator
base.AddMenu(New MenuItem(MenuItem.TextSeparator))

' Add a sub menu
Var submenu As New MenuItem("SubMenu")
submenu.AddMenu(New MenuItem("SubMenu Test 1"))
submenu.AddMenu(New MenuItem("SubMenu Test 2"))
submenu.AddMenu(New MenuItem("SubMenu Test 3"))
base.AddMenu(submenu)

' Add a Separator
base.AddMenu(New MenuItem(MenuItem.TextSeparator))

Return True
```

<div id="combobox.contextualmenuaction">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.ContextualMenuAction

**ContextualMenuAction**(HitItem As `MenuItem</api/deprecated/menuitem>`) As `Boolean</api/data_types/boolean>`

Fires when a contextual menuitem *hitItem* was selected but the Action event and the MenuHandler for the menuitem did not handle the menu selection.

This event gives you a chance to handle the menu selection by inspecting the menuitem's Text or Tag properties to see which item was selected. Use this in conjunction with ConstructContextualMenu if you have not specified the Action event or the Menu Handler for the items on the contextual menu. See the example of a contextual menu in the examples for the **RectControl** class.

`Return</api/language/return>` `True</api/language/true>` if this event has handled the item the user chose from the contextual menu. Returning `False</api/language/false>` will cause the control's parent to execute its ContextualMenuAction event. This can be handy if you have the same contextual menu for several controls who share the same `Parent<rectcontrol.parent>` (several on the same window for example). By returning `False</api/language/false>` you can handle them all in a single event.

This simple event handler displays the value of the selected menu item.

``` xojo
If hitItem <> Nil Then MessageBox(hitItem.Value)
Return True
```

<div id="combobox.dragenter">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.DragEnter

**DragEnter**(obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `Integer</api/data_types/integer>`) As `Boolean</api/data_types/boolean>`

Fires when the passed `DragItem</api/user_interface/desktop/dragitem>` enters the RectControl.

Returns a `Boolean</api/data_types/boolean>`. Return `True</api/language/true>` from this event to prevent the drop from occurring.

The Action parameter specifies the drag action. It can take the following class constants of the `DragItem</api/user_interface/desktop/dragitem>` class:

| Value | Class Constant                                                     |
|-------|--------------------------------------------------------------------|
| 0     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionDefault |
| 1     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionCopy    |
| 2     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionMove    |
| 3     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionLink    |

To restrict file drops to just folders (and not files), you can put this code in the DragEnter event:

``` xojo
If Not obj.FolderItem.IsFolder Then Return True
```

<div id="combobox.dragexit">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.DragExit

**DragExit**(obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `Integer</api/data_types/integer>`)

Fires when the passed `DragItem</api/user_interface/desktop/dragitem>` exits the RectControl.

The *Obj* parameter is the item being dragged. The *Action* parameter specifies the drag action. It can take the following class constants of the `DragItem</api/user_interface/desktop/dragitem>` class:

| Value | Constant                                                           |
|-------|--------------------------------------------------------------------|
| 0     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionDefault |
| 1     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionCopy    |
| 2     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionMove    |
| 3     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionLink    |

<div id="combobox.dragover">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.DragOver

**DragOver**(x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, obj As `DragItem</api/user_interface/desktop/dragitem>`, Action As `Integer</api/data_types/integer>`) As `Boolean</api/data_types/boolean>`

Fires when the `DragItem</api/user_interface/desktop/dragitem>` is over the RectControl.

The *Obj* parameter is the object being dragged. The coordinates x and y are relative to the **RectControl**. Returns a `Boolean</api/data_types/boolean>`. Return `True</api/language/true>` from this event to prevent the drop from occurring.

The *Action* parameter specifies the drag action, which is typically done by holding down a modifier key (Shift, Alt, Option, Command, etc.) while doing the drag. It can take the following class constants of the `DragItem</api/user_interface/desktop/dragitem>` class:

| Value | Constant                                                           |
|-------|--------------------------------------------------------------------|
| 0     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionDefault |
| 1     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionCopy    |
| 2     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionMove    |
| 3     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionLink    |

<div id="combobox.dropobject">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.DropObject

**DropObject**(Obj As `DragItem</api/user_interface/desktop/dragitem>` Action As `Integer</api/data_types/integer>`)

The item represented by *Obj* has been dropped on the control.

The *Obj* parameter is the object being dragged. The *Action* parameter specifies the drag action. It can take the following class constants of the `DragItem</api/user_interface/desktop/dragitem>` class:

| Value | Constant                                                           |
|-------|--------------------------------------------------------------------|
| 0     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionDefault |
| 1     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionCopy    |
| 2     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionMove    |
| 3     | `DragItem</api/user_interface/desktop/dragitem>`.DragActionLink    |

The following DropObject event handler can handle either a dropped picture or a dropped file. The type of file that it can handle needs to have been specified in a call to AcceptFileDrop prior to the drop, for example, in the Open event.

``` xojo
If Obj.PictureAvailable Then
  Me.Image = obj.Picture
ElseIf Obj.FolderItemAvailable Then
  Me.Image = Picture.Open(obj.FolderItem)
End If
```

<div id="combobox.gotfocus">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.GotFocus

**GotFocus**

The `PopupMenu</api/deprecated/popupmenu>` has received the focus and has a selection rectangle around it.

<div class="note">

<div class="title">

Note

</div>

On Macintosh, controls other than text fields and lists will accept focus only if the full keyboard access option is enabled in System Preferences/Keyboard.

</div>

<div id="combobox.keydown">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.KeyDown

**KeyDown**(Key As `String</api/data_types/string>`) As `Boolean</api/data_types/boolean>`

The user has pressed the *Key* passed while the `control</api/deprecated/rectcontrol>` has the focus.

How KeyDown works depends on the type of control.

**TextField and TextArea** Returning `True</api/language/true>` means the key is intercepted, preventing the key from actually reaching the control at all. This would be useful if you want to override the behavior of the tab key for example. Returning `False</api/language/false>` means the key reaches the control.

**All Other Controls** Returning `True</api/language/true>` prevents the KeyDown event on the parent control (usually the window) from executing. Returning `False</api/language/false>` results in the execution of the KeyDown event of the parent control.

<div id="combobox.keyup">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.KeyUp

**KeyUp**(Key As `String</api/data_types/string>`)

Fires when the passed *Key* is released in the RectControl that has the focus.

It is not guaranteed to be the same key that received the KeyDown event.

<div id="combobox.lostfocus">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.LostFocus

**LostFocus**

The `PopupMenu</api/deprecated/popupmenu>` has lost the focus.

<div class="note">

<div class="title">

Note

</div>

On Macintosh, controls other than text fields and lists will accept and lose focus only if the full keyboard access option is enabled in System Preferences/Keyboard.

</div>

<div id="combobox.mousedown">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.MouseDown

**MouseDown**(x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`) As `Boolean</api/data_types/boolean>`

The mouse button was pressed inside the control's region at the location passed in to *x*, *y*.

The coordinates *x* and *y* are local to the control, i.e. they represent the position of the mouse click relative to the upper-left corner or the `PopupMenu</api/deprecated/popupmenu>`.

`Return</api/language/return>` `True</api/language/true>` if you are going to handle the MouseDown. In such a case:

- The Action event, if any, will not execute and the state of the object will not change.
- You will receive the `MouseUp<popupmenu.mouseup>` event.

If you return False, the system handles the MouseDown so the `MouseUp<popupmenu.mouseup>` event handler does not get called.

The MouseDown event uses the `DragItem</api/user_interface/desktop/dragitem>` constructor when the user drags the contents of the control. It is:

``` xojo
Var d As DragItem
d = New DragItem(Self, Me.Left, Me.Top, Me.Width, Me.Height)
d.Picture = Me.Image
d.Drag ' Allow the drag
```

<div id="combobox.mouseenter">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.MouseEnter

**MouseEnter**

The mouse has entered the area of the control.

<div id="combobox.mouseexit">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.MouseExit

**MouseExit**

The mouse has left the area of the control.

<div id="combobox.mousemove">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.MouseMove

**MouseMove**(X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`)

The mouse has moved within the control to the coordinates passed. The coordinates are local to the control, not to the window.

<div id="combobox.mouseup">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.MouseUp

**MouseUp**(x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`)

The mouse button was released. Use the *x* and *y* parameters to determine if the mouse button was released within the control's boundaries.

<div class="note">

<div class="title">

Note

</div>

This event will not occur unless you return `True</api/language/true>` in the MouseDown event. The return value is ignored.

</div>

The parameters *x* and *y* are local coordinates, i.e. they represent the position of the mouse click relative to the upper-left corner or the `PopupMenu</api/deprecated/popupmenu>`. Mouse clicks that are released to the left or above a control are negative.

<div id="combobox.mousewheel">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.MouseWheel

**MouseWheel**(X As `Integer</api/data_types/integer>`, Y As `Integer</api/data_types/integer>`, DeltaX As `Integer</api/data_types/integer>`, DeltaY As `Integer</api/data_types/integer>`) As `Boolean</api/data_types/boolean>`

The mouse wheel has been moved.

The parameters *X* and *Y* are the mouse coordinates relative to the control that has received the event. The parameters *DeltaX* and *DeltaY* hold the number of scroll lines the wheel has been moved horizontally and vertically, as defined by the operating system. *DeltaX* is positive when the user scrolls right and negative when scrolling to the left. *DeltaY* is positive when the user scrolls down and negative when scrolling up.

Returns a `Boolean</api/data_types/boolean>`. Return `True</api/language/true>` to prevent the event from propagating further.

<div id="combobox.open">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.Open

**Open**

The control is about to be displayed. Use this event to initialize a control.

The Open event is called after the Constructor.

Be warned that initializing control property values using the Constructor instead of the Open event may result in those property values being overwritten by what is set in the Inspector. For best results, use the Open event for control initialization rather than the control Constructor.

If the control is supposed to handle drag and drop, you need to tell it which type of item it needs to be able to handle. The following example informs the control that pictures and files can be dropped on it. The type of the file it needs to support is specified via the File Types Editor.

``` xojo
Sub Open()
  Me.AcceptPictureDrop
  Me.AcceptFileDrop("JPEG")
End Sub
```

<div id="combobox.textchanged">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

ComboBox.TextChanged

**TextChanged**

The text in the <span class="title-ref">ComboBox</span> has changed.

The following line in the TextChanged event handler displays either the currently selected menu item or the text typed into the <span class="title-ref">ComboBox</span>.

``` xojo
Label1.Text = Me.SelectedRowValue
```

## Notes

### Macos

On macOs, the <span class="title-ref">ComboBox</span> height is limited to just a single size, so any changes to the Height property are ignored.

Additionally, the maximum number of visible rows in the dropdown is 15. You can adjust this number using this declare, passing in the <span class="title-ref">ComboBox</span>'s handle for *controlHandle*:

``` xojo
Declare Sub setNumberOfVisibleItems Lib "AppKit" Selector "setNumberOfVisibleItems:" (controlHandle As Integer, count As Integer)
setNumberOfVisibleItems(MyComboBox.Handle, 30)
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Windows

On Windows, the <span class="title-ref">ComboBox</span> height is controlled by the font size, so any changes you make to the Height property are ignored.

## Sample code

This code in the Open event handler populates a <span class="title-ref">ComboBox</span> and sets the initial value to the current month:

``` xojo
Var s As String
Var last As Integer
Var d As New Date
s = "January,February,March,April,May,June,July," _
  + "August,September,October,November,December"
last = CountFields(s, ",")
For i As Integer = 1 To last
  Me.AddRow(NthField(s, ",", i))
Next
Me.ListIndex = d.Month - 1
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

The value of the SelectedRowIndex property contains the index of the selected item, but it does not indicate whether the user has entered a value into the <span class="title-ref">ComboBox</span>. Examine the Value property to get the current menu selection or the value entered by the user. For example, the following line in the TextChanged event handler displays either the currently selected menu item or the value typed into the <span class="title-ref">ComboBox</span>.

``` xojo
Label1.Text = Me.Text
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

This code adds an item to a <span class="title-ref">ComboBox</span> in its Open event handler.

``` xojo
Me.AddRow("October")
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

This code opens a new window when an item is chosen.

``` xojo
Sub Change()
  Var w As ListEditorWindow
  If ComboBox1.Text = "Edit List..." Then
    w = New ListEditorWindow
  End If
End Sub
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

The following code changes the selected item in a ComboBox

``` xojo
ComboBox1.SelectedRowIndex = 3
```

## Compatibility

All project types on all supported operating systems.

## See also

`PopupMenu</api/deprecated/popupmenu>` parent class; `TextField</api/deprecated/textfield>`, `PopupMenu</api/deprecated/popupmenu>` controls
