Package com.ms.ui Previous
Previous
Contents
Contents
Index
Index
Next
Next

Interface IUISelector

Methods , Fields

public interface IUISelector 
{
  // Fields
  public static final int SINGLESELECT;
  public static final int MULTISELECT;
  public static final int EXTENDSELECT;

  // Methods
  public int getSelectedIndex();
  public int[] getSelectedIndices();
  public Component getSelectedItem();
  public Component[] getSelectedItems();
  public int getSelectionMode();

  public void setSelectedIndex(int index);
  public void setSelectedIndex(int index, boolean notify);
  public void setSelectedIndices(int indices[]);
  public void setSelectedIndices(int indices[], boolean notify);
  public void setSelectedItem(Component comp);
  public void setSelectedItem(Component comp, boolean notify);
  public void setSelectedItems(Component comps[]);
  public void setSelectedItems(Component comps[], boolean notify);
  public void setSelectionMode(int selMode);

  public void selectIndex(int index);
  public void selectIndex(int index, boolean on);
  public void selectIndex(int index, boolean on, boolean notify);
  public void selectItem(Component comp);
  public void selectItem(Component comp, boolean on);
  public void selectItem(Component comp, boolean on, boolean notify);

}

Defines an interface for classes that manage the selection of child components. UISelector implements this interface.


Methods


getSelectedIndex

public int getSelectedIndex();

Retrieves the zero-based index of the currently selected item.

Return Value:

Returns the index of the selected item, or -1 if no item is selected.

Remarks:

This method is only valid for single-selection controls. If the selection mode is MULTISELECT or EXTENDSELECT, this method returns -1.


getSelectedIndices

public int[] getSelectedIndices();

Retrieves the zero-based indices of all currently selected items.

Return Value:

Returns an array of the indices of the selected items, or null if no item is selected.


getSelectedItem

public Component getSelectedItem();

Retrieves the currently selected item.

Return Value:

Returns the selected component, or null if no component is selected.

Remarks:

This method is only valid for single-selection controls. If the selection mode is MULTISELECT or EXTENDSELECT, this method returns null.


getSelectedItems

public Component[] getSelectedItems();

Retrieves all currently selected items.

Return Value:

Returns an array of the selected components, or null if no component is selected.


getSelectionMode

public int getSelectionMode();

Retrieves the selection mode of the control.

Return Value:

Returns one of the following three selection modes: SINGLESELECT, MULTISELECT, or EXTENDSELECT.


selectIndex

public void selectIndex(int index);

Sets the selected state of the component at the specified index, and sets the control's selection to this component. By default, a LIST_SELECT event is not generated.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the item to be selected.


selectIndex

public void selectIndex(int index, boolean on);

Sets or clears the selected state of the component at the specified index, and sets the control's selection to this component. By default, a LIST_SELECT event is not generated.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the item to be selected or de-selected.
on If true, the item's selected state is set; otherwise, it is cleared.


selectIndex

public void selectIndex(int index, boolean on, boolean notify);

Sets or clears the selected state of the component at the specified index, and sets the control's selection to this component. A LIST_SELECT event is optionally generated.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the item to be selected or de-selected.
on If true, the item's selected state is set; otherwise, it is cleared.
notify If true, a LIST_SELECT event will be generated; otherwise, a LIST_SELECT event will not be generated.


selectItem

public void selectItem(Component comp);

Sets the selected state of the specified component, and sets the control's selection to this component. By default, a LIST_SELECT event is not generated.

Return Value:

No return value.

ParameterDescription
index The item to be selected.


selectItem

public void selectItem(Component comp, boolean on);

Sets or clears the selected state of the specified component, and sets the control's selection to this component. By default, a LIST_SELECT event is not generated.

Return Value:

No return value.

ParameterDescription
index The item to be selected or de-selected.
on If true, the item's selected state is set; otherwise, it is cleared.


selectItem

public void selectItem(Component comp, boolean on, boolean notify);

Sets or clears the selected state of the specified component, and sets the control's selection to this component. A LIST_SELECT event is optionally generated.

Return Value:

No return value.

ParameterDescription
comp The item to be selected or de-selected.
on If true, the item's selected state is set; otherwise, it is cleared.
notify If true, a LIST_SELECT event will be generated; otherwise, a LIST_SELECT event will not be generated.


setSelectedIndex

public void setSelectedIndex(int index);

Sets the selection to the component at the specified index. By default, a LIST_SELECT event is not generated.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the item to be selected.

Remarks:

This method clears any previous selection.


setSelectedIndex

public void setSelectedIndex(int index, boolean notify);

Sets the selection to the component at the specified index, and optionally generates a LIST_SELECT event.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the item to be selected.
notify If true, a LIST_SELECT event will be generated; otherwise, a LIST_SELECT event will not be generated.

Remarks:

This method clears any previous selection.


setSelectedIndices

public void setSelectedIndices(int indices[]);

Sets the selection to the components at the specified indices. By default, LIST_SELECT events are not gerenated.

Return Value:

No return value.

ParameterDescription
indices An array containing the indices of the items to be selected.

Remarks:

This method clears any previous selection.


setSelectedIndices

public void setSelectedIndices(int indices[], boolean notify);

Sets the selection to the components at the specified indices, and optionally generates LIST_SELECT events.

Return Value:

No return value.

ParameterDescription
indices An array containing the indices of the items to be selected.
notify If true, LIST_SELECT events will be generated; otherwise, LIST_SELECT events will not be generated.

Remarks:

This method clears any previous selection.


setSelectedItem

public void setSelectedItem(Component comp);

Sets the selection to the specified component. By default, a LIST_SELECT event is not generated.

Return Value:

No return value.

ParameterDescription
comp The item to be selected.

Remarks:

This method clears any previous selection.


setSelectedItem

public void setSelectedItem(Component comp, boolean notify);

Sets the selection to the specified component, and optionally generates a LIST_SELECT event.

Return Value:

No return value.

ParameterDescription
comp The item to be selected.
notify If true, a LIST_SELECT event will be generated; otherwise, a LIST_SELECT event will not be generated.

Remarks:

This method clears any previous selection.


setSelectedItems

public void setSelectedItems(Component comps[]);

Sets the selection to the specified components. By default, LIST_SELECT events are not generated.

Return Value:

No return value.

ParameterDescription
comps An array containing the items to be selected.

Remarks:

This method clears any previous selection.


setSelectedItems

public void setSelectedItems(Component comps[], boolean notify);

Sets the selection to the specified components, and optionally generates LIST_SELECT events.

Return Value:

No return value.

ParameterDescription
comps An array containing the items to be selected.
notify If true, LIST_SELECT events will be generated; otherwise, LIST_SELECT events will not be generated.

Remarks:

This method clears any previous selection.


setSelectionMode

public void setSelectionMode(int selMode);

Sets the selection mode of the control.

Return Value:

No return value.

ParameterDescription
selMode The selection mode for the control. Specify SINGLESELECT, MULTISELECT, or EXTENDSELECT.


Fields

SINGLESELECT
Specifies that only one item may be selected at a time.
MULTISELECT
Specifies that multiple items may be selected by clicking each item to toggle its selected state.
EXTENDSELECT
Allows multiple items to be selected by using the SHIFT key to extend the selection.


Top© 1997 Microsoft Corporation. All rights reserved. Legal Notices.