A ListBox displays available options or values. If more options or values exist than can display in the ListBox at one time or the text exceeds the width of the ListBox, the ListBox has one or two (vertical or horizontal) scroll bars.
ListBox property |
Datatype |
Description |
---|---|---|
Integer |
Specifies the ASCII value of the key you want to assign as the accelerator key for a control. |
|
String |
A description of the control and/or its purpose for use by accessibility tools such as readers for visually impaired users. |
|
String |
A label that briefly describes the control, such as the text in a button or the name of a menu item. |
|
AccessibleRole (enumerated) |
Describes what kind of user interface element the control is. |
|
Long |
Specifies the numeric value of the background color: -2 to 16,777,215. For more information about color, see the section called “RGB” in PowerScript Reference. |
|
Boolean |
Specifies whether the control has a border. Values are: TRUE -- Control has a border. FALSE -- Control does not have a border. |
|
BorderStyle (enumerated) |
Specifies the style of the border of the control. Values are: StyleBox! StyleLowered! StyleRaised! StyleShadowBox! |
|
Boolean |
Specifies whether PowerBuilder moves the control to the top of the front-to-back order. Values are: TRUE -- Control moved to top. FALSE -- Control not moved to top. |
|
ClassDefinition |
PowerObject |
An object of type PowerObject containing information about the class definition of the object or control. |
Boolean |
Specifies behavior of a scroll bar. Values are: TRUE -- The scroll bar is always visible but is disabled when all the items can be accessed without it. FALSE -- The scroll bar is displayed only if it is necessary (based on the number of items and the height of the list box). |
|
Boolean |
Specifies whether PowerBuilder puts the control automatically into Drag mode. Values are: TRUE -- When the control is clicked, the control is automatically in Drag mode. FALSE -- When the control is clicked, the control is not automatically in Drag mode. You have to manually put the control into Drag mode by using the Drag function. |
|
String |
Specifies the name of the stock icon or the file containing the icon you want to display when the user drags the control (the ICO file). The default icon is a box the size of the control. When the user drags the control, the icon displays when the control is over an area in which the control can be dropped (a valid drop area). When the control is over an area that is not a valid drop area, the No-Drop icon displays. |
|
Boolean |
Specifies whether the control is enabled (can be selected). Values are: TRUE -- Control can be selected. FALSE -- Control cannot be selected. |
|
Boolean |
Specifies whether users can select multiple items in the list box at one time. Values are: TRUE -- Users can select multiple items by clicking on an item and dragging the mouse up or down to select items; using Click or Shift+ Click to select a sequential group of items; or using Ctrl+ Click on multiple items. FALSE -- Users cannot select multiple items. Used with MultiSelect The MultiSelect property allows users to select multiple items in a list box by simply clicking on the items. If MultiSelect = true and ExtendedSelect = true, then the behavior of ExtendedSelect takes precedence. |
|
String |
Specifies the name of the typeface in which the text of the control displays (for example, arial or courier). |
|
FontCharSet (enumerated) |
Specifies the font character set used for the text in the control. For a complete list of possible values, see the list of properties for the FontCharSet variable on the Enumerated tab page of the Browser. |
|
FontFamily (enumerated) |
Specifies the font family (type style) used for the text in the control. Values are: AnyFont! Decorative! Modern! Roman! Script! Swiss! |
|
FontPitch (enumerated) |
Specifies the pitch (spacing) of the font used for the text in the control. Values are: Default! Fixed! Variable! |
|
Integer |
Specifies the height of the control, in PowerBuilder units. |
|
Boolean |
Specifies whether a horizontal scroll bar displays. Values are: TRUE -- Horizontal scroll bar displays. FALSE -- Horizontal scroll bar does not display. |
|
Boolean |
Specifies whether the text in the control is italic. Values are: TRUE -- Text is italic. FALSE -- Text is not italic. |
|
String |
Specifies the items in the control. |
|
Boolean |
Specifies whether users can select multiple items in the ListBox at one time. Values are: TRUE -- Users can select multiple items. FALSE -- Users cannot select multiple items. Used with ExtendedSelect The MultiSelect property allows users to select multiple items in a list box by simply clicking on the items. If MultiSelect = true and ExtendedSelect = true, then the behavior of ExtendedSelect takes precedence. |
|
String |
Specifies the name of the stock pointer or the file containing the pointer used for the control. |
|
Boolean |
Specifies that characters should be displayed in right-to-left order. The application must be running on an operating system that supports right-to-left display. Values are: TRUE -- Characters display in right-to-left order. FALSE -- Characters display in left-to-right order. |
|
Boolean |
Specifies whether the items in the ListBox are sorted. Values are: TRUE -- Items are sorted. FALSE -- Items are not sorted. |
|
Integer |
Specifies the tab value of the control (0 means the user cannot tab to the control). |
|
Integer array |
Specifies the positions of the tab stops in the ListBox. The tab stops are in character positions, and the tab stop delimiter is a space. If you assign a value to only the first tab stop, TabStop[1], the tab stops are equally spaced using the number of character positions specified for the first tab stop. If more than one tab stop is entered, tab stops are located in the positions specified. You can define 16 tab stops in the control; the default array is TabStop[8], with a tab stop every eight character positions. |
|
String |
Specifies the tag value assigned to the control. |
|
Long |
Specifies the numeric value of the color used for text: -2 to 16,777,215. For more information about color, see the section called “RGB” in PowerScript Reference. |
|
Integer |
Specifies the size of the text in the control, in points. For backward compatibility, the size is stored as a negative number; for example, 10-point text size is stored as -10. |
|
Boolean |
Specifies whether the text in the control is underlined. Values are: TRUE -- Text is underlined. FALSE -- Text is not underlined. |
|
Boolean |
Specifies whether the control is visible. Values are: TRUE -- Control is visible. FALSE -- Control is not visible. |
|
Boolean |
Specifies whether a vertical scroll bar is displayed on the right of the ListBox. Values are: TRUE -- Vertical scroll bar is displayed. FALSE -- Vertical scroll bar is not displayed. |
|
Integer |
Specifies the stroke weight of the text in the control; for example, 400 for normal or 700 for bold. |
|
Integer |
Specifies the width of the control, in PowerBuilder units. |
|
Integer |
Specifies the X position (the distance from the left edge of the window), in PowerBuilder units. |
|
Integer |
Specifies the Y position (the distance from the top of the window), in PowerBuilder units. |
ListBox event |
Occurs |
---|---|
Immediately before the Open event occurs in the window |
|
Immediately after the Close event occurs in the window |
|
When the control is double-clicked (selected and activated) |
|
When a dragged control is dropped on the control |
|
When a dragged control enters the control |
|
When a dragged control leaves the control |
|
When a dragged control is within the control |
|
Just before the control receives focus (before it is selected and becomes active) |
|
When the user presses the F1 key or drags the context help button (question mark) from the title bar to a menu item or control |
|
When the control loses focus (becomes inactive) |
|
When a Controls message occurs that is not a PowerBuilder event |
|
When the right mouse button is pressed on the control |
|
When an item in the control is selected |
ListBox function |
Datatype returned |
Description |
---|---|---|
Integer |
Adds a new item to the end of the ListBox. If the Sorted property of the control is true, the items are sorted again after the item is added. The AddItem function does not update the Item[ ] property of this control. |
|
String |
Returns the name assigned to the control. |
|
Integer |
Deletes the item indicated by the index from the ListBox. |
|
Boolean |
Populates the ListBox with a list of the files of the specified type that match the specified file pattern. |
|
Boolean |
Returns the current selection for the control and puts it in the specified variable. |
|
Integer |
Starts or ends the dragging of a control. |
|
Integer |
Finds the first item in the ListBox (after the specified index) that begins with the specified string. |
|
Integer |
Creates a reference to a context-specific instance of the specified service. |
|
PowerObject |
Returns a reference to the name of the parent object. |
|
Integer |
Makes the control invisible. |
|
Integer |
Adds a new item to the ListBox before the item indicated by the index. If the Sorted property of the control is true, the items are sorted again after the item is added. |
|
Integer |
Moves the control to a specified location. |
|
Integer |
Returns the distance of the pointer from the left edge of the control. |
|
Integer |
Returns the distance of the pointer from the top of the control. |
|
Boolean |
Adds an event to the end of the message queue for the control. |
|
Integer |
Prints the control. |
|
Integer |
Removes all items from the control. |
|
Integer |
Changes the size of the control. |
|
Integer |
Returns the index of the item in the ListBox that is currently selected. If more than one item is selected, returns the index of the first selected item. |
|
String |
Returns the text of the first selected item. |
|
Integer |
Finds and highlights an item in the control. Use Syntax 1 when you know the text of the item but not its position. Use Syntax 2 when you know the position of the item in the control's list or you want to clear the current selection. SelectItem has no effect on a ListBox whose MultiSelect property is true. Instead, use SetState to select items without affecting the selected state of other items in the list. |
|
Integer |
Sets focus to the control. |
|
Integer |
Specifies the position of the control in the front-to-back order of the window. |
|
Integer |
Controls automatic redrawing of the control after each change in its properties. |
|
Integer |
Sets the state (highlighted or not highlighted) of the item indicated by the specified index. SetState works only for multiselect controls (those for which the MultiSelect property is true). |
|
Integer |
Scrolls the items in the control so that the item indicated by the specified index is at the top of the control. |
|
Integer |
Makes the control visible. |
|
Integer |
Returns 1 if the item specified by the specified index is selected (highlighted) and 0 if the item is not selected. |
|
String |
Returns the text of the item in the control identified by the specified index. |
|
Integer |
Returns the index number of the item currently at the top of the control. |
|
Integer |
Returns the total number of items in the control. |
|
Integer |
Returns the total number of items selected in the control. |
|
Integer |
Triggers a specified event in the control and executes the script for the event. |
|
Object |
Returns the type of the control. |