ImcComboItem class

One item of an ImageCombo: its number, its key, its text, its pictures, its indentation, and whether it is the selected item. A program gets one from the ImcComboItems collection, from that collection’s Add method, and from the SelectedItem, TopItem and FindItem members of the control.

Dim Item As ImcComboItem
Set Item = ImageCombo1.ComboItems.Add(, "open", "Open")
Item.Tag = "Opens a file"
Item.Data = 42
Debug.Print Item.Index & " " & Item.Key & " " & Item.Text
Debug.Print ImageCombo1.ComboItems("open").Tag; ImageCombo1.ComboItems("open").Data
' Output:
' 1 open Open
' Opens a file 42

A program cannot make an ImcComboItem object with New.

An object kept in a variable after its item is removed from the list still has its old number, and its other members then work on the item that has that number now.

Properties

Data

A number of the program’s own that the item holds, such as the key of the record the item stands for. LongPtr. A new item has 0.

An assignment is kept with the item.

Image

The picture that the item shows, in the image list of the ImageCombo: its number from 1, or its key. Variant. 0 for an item with no picture. A key can be assigned only while the control has an image list that can look keys up, which The pictures describes.

Reading it returns what was assigned, a number or a key, and ImageIndex the number. A key that the image list does not have raises run-time error 35601, and a negative number raises 35600; the item keeps its picture. A number is not compared with the number of pictures in the list.

ImageIndex

The number of the picture that Image names, in the image list, from 1. Long, read-only. 0 for an item with no picture.

Indentation

How far the item is indented, in widths of a picture of the image list. Long. A new item has the Indentation of the control, unless Add gave it one.

Index

The number of the item in the list, from 1. Long, read-only. It changes when an item is added or removed before this one.

Key

The key of the item in the ImcComboItems collection. String. Empty for an item without a key.

An assignment gives the item another key, and the collection no longer finds it by the old one. An empty string takes the key away. A key that another item of the list has raises run-time error 457, and the item keeps its key.

Selected

Whether the item is the selected item of the control. Boolean. An assignment of True selects the item. If the item was not selected, the text box of an ImcStyleDropDownCombo control takes the item’s text, and the control raises Change and then Click. An assignment of False to the selected item removes the selection and empties the text box, and raises Change and then Click.

See The selection and the text.

An assignment of False to an item that is not selected leaves the selection as it is, and raises no event.

SelImage

The picture that the item shows while it is the selected item, in the text box and in the list: its number in the image list, from 1. Long. 0, the default, means the picture of Image. A negative number raises run-time error 35600.

An assignment takes a number: a key raises run-time error 13. SelImageIndex is the number as the control keeps it.

Note 1.8.141.0

A key that Add took for its SelImage gives the item the right picture, but reading SelImage then raises run-time error 13. SelImageIndex gives the picture’s number all the same.

SelImageIndex

The number of the picture that SelImage names, in the image list, from 1. Long, read-only. 0 when the item has none of its own.

Tag

A value of the program’s own, which the control does not use. Variant: unlike the Tag of a control it holds a value of any type, an object included, which is assigned with Set.

A new item has an empty string.

Text

The text of the item. String. It is the default member, so ImageCombo1.ComboItems(1) is the text of the first item.

An assignment changes the text in the list. When the item is the selected one of an ImcStyleDropDownCombo control, the text box receives the new text and the control raises Change. An item holds at most 259 characters, and a longer text loses what is beyond that.

See Also