DhListBox Class

DhListBox Class

This Package | All Packages

DhSelectBox
  |
  +--DhListBox
public class DhListBox
extends DhSelectBox

Represents a list box control. This class manages adding, removing, and selecting items, as well as scrolling. The list box control can be used within a form (see DhSection) to transmit data.

Constructors
Name Description
DhListBox( ) Creates a DhListBox control.
DhListBox( int nRows, int selectionStyle) Creates a DhListBox object.

Methods
Name Description
getAlignment() Retrieves the current alignment value of the list box.
getSelectionStyle() Returns the current selection style of the list box.
getVisibleRows( ) Retrieves the number of currently visible rows.
setAlignment( int nAlignment ) Sets the alignment of the list box relative to the text around it.
setSelectionStyle(int value) Determines how many items at a time can be selected in the list box.
setVisibleRows( int nRows ) Sets the number of visible rows in the list box.

Constructors

DhListBox.DhListBox

Syntax 1
public DhListBox( );
Description

Creates a DhListBox control. This default constructor creates a list box control with two visible rows, which allows only single selections.



Syntax 2
public DhListBox( int nRows, int selectionStyle );
Parameters
nRows
The initial number of visible rows. This must be greater than 1.
selectionStyle
A value determining whether the user can select multiple rows. This can be any value in com.ms.wfc.cor.SelectionStyle.
Description

Creates a DhListBox object.

Methods

DhListBox.getAlignment

Syntax
public int getAlignment();
Description

Retrieves the current alignment value of the list box. Returns one of the alignment constant values in DhAlignEnum.

See Also
wfc.html.DhAlignEnum

DhListBox.getSelectionStyle

Syntax
public int getSelectionStyle();
Return Value

Returns the selection style. Possible values are:

Description

Returns the current selection style of the list box.

See Also
wfc.cor.SelectionStyle

DhListBox.getVisibleRows

Syntax
public int getVisibleRows( );
Return Value

Returns the number of rows.

Description

Retrieves the number of currently visible rows.

DhListBox.setAlignment

Syntax
public void setAlignment( int nAlignment );
Parameters
nAlignment
The new alignment, which can be one of the alignment constant values in DhAlignEnum.
Description

Sets the alignment of the list box relative to the text around it.

See Also
wfc.html.DhAlignEnum

DhListBox.setSelectionStyle

Syntax
public void setSelectionStyle( int value );
Parameters
value
The new selection style. Possible values are:
  • SelectionStyle.NONE, which indicates that items can be selected in the list.
  • SelectionStyle.MULTI_EXTENDED, which indicates that more than one item at a time can be selected and keyboard characters such as SHIFT and CTRL can be used to assist in the selection.

Note that The SelectionStyle.ONE and SelectionStyle.MULTI_SIMPLE are not valid for DhListBox.

Description

Determines how many items at a time can be selected in the list box.

DhListBox.setVisibleRows

Syntax
public void setVisibleRows( int nRows );
Parameters
nRows
Number of rows. This must be greater than 1.
Description

Sets the number of visible rows in the list box.

Exceptions

IllegalArgumentException thrown if nRow is less than 2.