ListBox                                                                       Object

ADDOBJECT "ListBox", name, xpos, ypos, width, height

Description

ListBox is used to display a text list object that floats over the output window. The required component, name, is the name of a variable that is added to the program to reference the object. It must follow standard variable naming conventions. The required components, xpos, ypos, width, and height are numeric expressions that set the location and size of the object in pixels, measured from the upper left corner. The ListIndex property is the index of the selected item in the list, the index of the first item is 0; if no item is selected, the ListIndex property is -1. MultiSelect must be set to True before any items are added to the listbox.

Properties Supported (see "Properties")

BackColor, Enabled, FontBold, FontItalic, FontName, FontSize, FontStrikethru, FontUnderline, ForeColor, Height, Hwnd, IntegralHeight, Left, List (read only), ListCount (read-only), ListIndex, MultiSelect, Name, NewIndex, ParentHWnd, Redraw, ScrollBars, SelCount, Selected, SpinBox, Sorted, Tag, TabStop, Text, Timer, Top, TopIndex, Visible, Width, WindowLong

Methods Supported (see "Methods")

AddItem, Clear, Hide, Move, RemoveItem, SetFocus, Show

Events Supported (see "Events")

Change, Click, DblClick, GotFocus, KeyDown, KeyPress, KeyUp, LostFocus, Timer

Example

REM ListBox Example

'ListBox is a text list object

DIM i

ADDOBJECT "ListBox", "List", 10, 10, 100,100

List.ScrollBars = 2

FOR i = vbSUNDAY TO vbSATURDAY

  List.AddItem WEEKDAYNAME(i)

NEXT

List.ListIndex = WEEKDAY(NOW-1)

List.SetFocus

Output

Related Items

ADDOBJECT, ComboBox, Events, Methods, Properties