List boxes display a list from which a user can select one or more items. A list box is created with a vertical scroll bar, a horizontal control bar, or both.
The window class name for a list box is "LISTBOX".
Supported Properties and Methods
- The list box object itself does not have a DefaultAction property; however, DoDefaultAction double clicks list box items.
- The HitTest method returns zero if the tested point is within the list box but not on an item in the list box. If the tested point is on an item in the list box, HitTest returns the index of the list box item.
- The ChildCount is the number of items in the list box.
- The list box object itself does not have a DefaultAction property; however, the DefaultAction property for each list item is "Double Click".
- The KeyboardShortcut property is the list box's access key, which is an underlined character in the text of the label associated with the list box. The returned string contains the access key character appended to the string "Alt+".
- The Name property for the list box object is the text from a static text control that labels the list box. For the list box items, the Name property is the text of the list item.
- The Parent property is a window (ROLE_SYSTEM_WINDOW) that surrounds the list box and has the same Name property and window class name as the list box. The Parent property of the list box items is the list box object.
- The Role property is ROLE_SYSTEM_LIST. The items in the list box have the Role property of ROLE_SYSTEM_LISTITEM.
- The Selection property retrieves the selected items in the list box.
- The State property of the list box object is a combination of one or more of the following values:
STATE_SYSTEM_INVISIBLE | STATE_SYSTEM_UNAVAILABLE | STATE_SYSTEM_FOCUSED | STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_OFFSCREEN
The State property of the list box item is a combination of one or more of the following values:
STATE_SYSTEM_INVISIBLE | STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_FOCUSED | STATE_SYSTEM_SELECTABLE | STATE_SYSTEM_MULTISELECTABLE | STATE_SYSTEM_SELECTED | STATE_SYSTEM_OFFSCREEN | STATE_SYSTEM_NORMAL