Packages
 In this topic

*Constructors

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.ui   Previous This
Package
Next

 


Class UISelector

public abstract class UISelector extends UIPanel implements 
            IUISelector, TimerListener
{
  // Constructors
  public UISelector();
  public UISelector(int selMode);

  // Methods
  public synchronized void addActionListener(IUIActionListener l);
  public synchronized void addItemListener(IUIItemListener l);
  public void addSelectedIndex(int index);
  public void addSelectedIndex(int index, boolean notify);
  public void addSelectedIndices(int indices[]);
  public void addSelectedIndices(int indices[], boolean notify);
  public void addSelectedItem(IUIComponent comp);
  public void addSelectedItem(IUIComponent comp, boolean notify);
  public void addSelectedItems(IUIComponent comps[]);
  public void addSelectedItems(IUIComponent comps[],
        boolean notify);
  public IUIComponent find(String prefix);
  public IUIComponent find(String prefix, boolean fromFocus);
  public IUIComponent find(String prefix, IUIComponent compStart);
  public IUIComponent find(String prefix, IUIComponent compStart,
        boolean keyable);
  public IUIComponent getAnchorItem();
  public IUIComponent getExtensionItem();
  public int getRoleCode();
  public int getSelectedIndex();
  public int[] getSelectedIndices();
  public IUIComponent getSelectedItem();
  public IUIComponent[] getSelectedItems();
  public int getSelectionMode();
  public int getStateCode();
  public boolean gotFocus(Event e, Object o);
  public boolean keyDown(Event e, int key);
  public boolean lostFocus(Event e, Object o);
  public boolean mouseDown(Event e, int x, int y);
  public boolean mouseDrag(Event e, int x, int y);
  protected void processActionEvent(UIActionEvent e);
  protected void processEvent(UIEvent e);
  protected void processItemEvent(UIItemEvent e);
  public void remove(int index);
  public void remove(IUIComponent comp);
  public synchronized void removeActionListener(
        IUIActionListener l);
  public synchronized void removeItemListener(IUIItemListener l);
  public void removeSelectedIndex(int index);
  public void removeSelectedIndex(int index, boolean notify);
  public void removeSelectedIndices(int indices[]);
  public void removeSelectedIndices(int indices[], boolean notify);
  public void removeSelectedItem(IUIComponent comp);
  public void removeSelectedItem(IUIComponent comp, boolean notify);
  public void removeSelectedItems(IUIComponent comps[]);
  public void removeSelectedItems(IUIComponent comps[],
        boolean notify);
  public void setAnchorItem(IUIComponent comp);
  public void setExtensionItem(IUIComponent comp);
  public void setSelected(boolean on);
  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(IUIComponent comp);
  public void setSelectedItem(IUIComponent comp, boolean notify);
  public void setSelectedItems(IUIComponent comps[]);
  public void setSelectedItems(IUIComponent comps[],
        boolean notify);
  public void setSelectionMode(int selMode);
  public void timeTriggered(TimerEvent te);
}

This class implements an abstract selector control. The following diagram shows the classes that extend UISelector.

UISelector
|
+--UIList
|
+--UITabList
|
+--UITree

By implementing the IUISelector interface, UISelector supports the selection modes in the following table.
SINGLESELECT The user may only select one item at a time.
MULTISELECT The user may select or deselect any item by clicking it.
EXTENDSELECT Behaves like SINGLESELECT, except when either the SHIFT or the CTRL key is down. SHIFT+click extends selection to current position. CTRL+click selects or deselects the currently focused item, without affecting any other selections. CTRL+SHIFT+click is a combination of the two.
NOSELECT Items may only be selected programatically.

The following examples show how to call some of these methods for a UIList control.

// Create two list controls.
UIList fruits = new UIList();  // SINGLESELECT by default.
UIList vegetables = new UIList(UISelector.MULTISELECT);

// Add items to the fruits list.
IUIComponent f1 = fruits.add("apple");
IUIComponent f2 = fruits.add("banana");
IUIComponent f3 = fruits.add("cherry");
add(fruits);  // Add the control to the container.

// Set the selection in the fruits list to the first item,
// at index 0. A list select event will not be generated.
fruits.setSelectedIndex(0);

// Now add items to the vegetables list.
IUIComponent v1 = vegetables.add("carrot");
IUIComponent v2 = vegetables.add("broccoli");
IUIComponent v3 = vegetables.add("zucchini");
add(vegetables);  // Add the control to the container.

// Create an array of components that will set the
// selection to the first and third items in the 
// vegetables list.
UIComponent selComps[] = new UIComponent[2];
selComps[0] = v1;
selComps[1] = v3;

// Set the selection to the components 
// identified by the selComps array. Specify 
// that a list select event will be generated.
vegetables.setSelectedItems(selComps, true);

// Trap the list select event.
public boolean handleEvent(Event e)
{
   // A list select event is always generated
   // when the user selects an item. Calls to 
   // the setSelectedXXX and selectXXX methods 
   // can optionally generate this event.
   if (e.id == Event.LIST_SELECT)
   {
      if (e.target == vegetables)
      {
         // Do something here.
         return true;
      }
      else if (e.target == fruits)
      {
         // Do something here.
         return true;
      }
   }
   return false;
}

The addSelectedIndex and addSelectedItem methods are similar to setSelectedIndex and setSelectedItem, respectively. All four methods enable you to set an item's selected state. To clear a selection call fruits.removeSelectedIndex(i) or fruits.setSelectedIndex(-1). The first call will clear the ith selection. The last call will clear all selections.

The optional boolean argument in these methods is used to specify whether a LIST_SELECT or DESELECT event should be generated. For example, fruits.addSelectedIndex(i, false),will select the item at index i, without affecting anything else and will not generate a LIST_SELECT.

Comments:

Calls to the setSelectedXXX, removeSelectedXXX and addSelectedXXX methods should be made from the outermost level of the selector. For example, suppose you have a tree called food and this tree contains trees called fruit, vegetables, and meat. Suppose that the fruit tree has a banana item. To select the banana item, call food.setSelectedItem(banana) not fruit.setSelectedItem(banana).

UIComponent
  |
  +--UIContainer
    |
    +--UIStateContainer
      |
      +--UIPanel
        |
        +--UISelector

Constructors

UISelector

public UISelector();

Creates a selector control with the SINGLESELECT selection mode.

UISelector

public UISelector(int selMode);

Creates a selector control with the specified selection mode.

ParameterDescription
selMode The selection mode. Possible values include SINGLESELECT, MULTISELECT, or EXTENDSELECT.

Exceptions:

IllegalArgumentException if an undefined selection mode was specified.

Methods

addActionListener

public synchronized void addActionListener(IUIActionListener l);

Adds the specified action listener. The listener receives all action events generated for the control.

Return Value:

No return value.

ParameterDescription
l The action listener to be added.

Remarks:

This method implements addActionListener in the IUISelector interface.

See Also: removeActionListener

addItemListener

public synchronized void addItemListener(IUIItemListener l);

Adds the specified item listener. The listener receives all item events generated for the control. (Item events are generated when the state of an item changes.)

Return Value:

No return value.

ParameterDescription
l The item listener to be added.

Remarks:

This method implements addItemListener in the IUISelector interface.

See Also: removeItemListener

addSelectedIndex

public void addSelectedIndex(int index);

Selects the component at the specified index, without affecting other selections. By default, list select events are not generated.

Return Value:

No return value.

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

addSelectedIndex

public void addSelectedIndex(int index, boolean notify);

Selects the component at the specified index, without affecting other selections. Optionally generates list select events.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the item to be selected.
notify If true, list select events will be generated; otherwise, list select events will not be generated.

addSelectedIndices

public void addSelectedIndices(int indices[]);

Selects the components at the specified indices, without affecting other selections. By default, list select events are not generated.

Return Value:

No return value.

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

addSelectedIndices

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

Selects the components at the specified indices, without affecting other selections. 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.

addSelectedItem

public void addSelectedItem(IUIComponent comp);

Selects the specified component, without affecting other selections. By default, list select events are not generated.

Return Value:

No return value.

ParameterDescription
comp The component to be selected.

addSelectedItem

public void addSelectedItem(IUIComponent comp, boolean notify);

Selects the specified component, without affecting other selections. Optionally generates list select events.

Return Value:

No return value.

ParameterDescription
comp The component to be selected.
notify If true, list select events will be generated; otherwise, list select events will not be generated.

addSelectedItems

public void addSelectedItems(IUIComponent comps[]);

Selects the specified components, without affecting other selections. By default, list select events are not generated.

Return Value:

No return value.

ParameterDescription
comps An array containing the components to be selected.

addSelectedItems

public void addSelectedItems(IUIComponent comps[], boolean notify);

Selects the specified components, without affecting other selections. Optionally generates list select events.

Return Value:

No return value.

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

find

public IUIComponent find(String prefix);

Searches the selector control for a keyable item whose name begins with the specified prefix, starting at the first item in the control.

Note find will return a UITab component when a UITabList object is used. Since a UITree object can have anything as its child, the child object will simply be returned.

Return Value:

Returns the first matching component; otherwise, returns null.

ParameterDescription
prefix The prefix string to search for.

find

public IUIComponent find(String prefix, boolean fromFocus);

Searches the selector control for a keyable item whose name begins with the specified prefix. The search begins from either the current focus, or the first item in the selector.

Note find will return a UITab item when a UITabList object is used. It will return a UITree item when a UITree object is used. The tree must be visible before calling find.

Return Value:

Returns the first matching component; otherwise, returns null.

ParameterDescription
prefix The prefix string to search for.
fromFocus If true, the search begins from the current focus. Otherwise, the search begins with the first item in the selector.

find

public IUIComponent find(String prefix, IUIComponent compStart);

Searches the selector control for a keyable item whose name begins with the specified prefix. The search begins at compStart.

Note find will return a UITab item when a UITabList object is used. It will return a UITree item when a UITree object is used. The tree must be visible before calling find.

Return Value:

Returns the first matching component; otherwise, returns null.

ParameterDescription
prefix The prefix string to search for.
compStart The component at which the search begins. If it is null, search will begin at the first item (according to navigate).

find

public IUIComponent find(String prefix, IUIComponent compStart,
        boolean keyable);

Searches the selector control for an item whose name begins with the specified prefix. The search begins at compStart, and can be performed on all components (keyable = false), or only keyable components (keyable = true).

Note Components in an unexpanded tree are not keyable. Specify (keyable = false) to search all items in a tree, regardless of whether the items are in a collapsed state.

Return Value:

Returns the first matching component; otherwise, returns null.

ParameterDescription
prefix The prefix string to search for.
compStart The component at which the search begins. If it is null, the search will begin at the first item.
keyable If true, only keyable components are searched. Otherwise, all components are searched.

getAnchorItem

public IUIComponent getAnchorItem();

Retrieves the component that is the current anchor in extend select mode.

Return Value:

Returns the component that is the anchor.

getExtensionItem

public IUIComponent getExtensionItem();

Retrieves the item from which a selection last extended from the anchor item.

Note This method is only used in the EXTENDSELECT mode.

Return Value:

Returns the extension item.

getRoleCode

public int getRoleCode();

Retrieves the ROLE_SYSTEM code that best describes the role of the selector control.

Return Value:

Returns the ROLE_SYSTEM_LIST code.

getSelectedIndex

public int getSelectedIndex();

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

Return Value:

Returns the index of the selected item, if an item is selected; otherwise, returns null. If the root node of a UITree object displays an item, this item is at index 0 and the first child item is at index 1. Otherwise, the first child item begins at index 0. For UIList and UITabList objects, the first item is always at index 0.

Remarks:

This method implements getSelectedIndex in the IUISelector interface. If the control's selection mode is MULTISELECT or EXTENDSELECT, you can also call getSelectedIndices.

For related code examples, see the UISelector overview.

See Also: getSelectedItem, setSelectedIndex

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, if an item is selected; otherwise, returns null. If the root node of a UITree object displays an item, this item is at index 0 and the first child item is at index 1. Otherwise, the first child item begins at index 0. For UIList and UITabList objects, the first item is always at index 0.

Remarks:

This method implements getSelectedIndices in the IUISelector interface. For related code examples, see the UISelector overview.

See Also: getSelectedIndex, getSelectedItems, setSelectedIndices

getSelectedItem

public IUIComponent getSelectedItem();

Retrieves the currently selected item.

Return Value:

Returns the selected component, if a component is selected; otherwise, returns null.

Remarks:

This method implements getSelectedItem in the IUISelector interface. If the control's selection mode is MULTISELECT or EXTENDSELECT, you can also call getSelectedItems.

For related code examples, see the UISelector overview.

See Also: getSelectedIndex, setSelectedItem

getSelectedItems

public IUIComponent[] getSelectedItems();

Retrieves all currently selected items.

Return Value:

Returns an array of the selected components, if a component is selected; otherwise, returns null.

Remarks:

This method implements getSelectedItems in the IUISelector interface. For related code examples, see the UISelector overview.

See Also: getSelectedItem, getSelectedIndices, setSelectedItems

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.

Remarks:

This method implements getSelectionMode in the IUISelector interface.

See Also: setSelectionMode

getStateCode

public int getStateCode();

Retrieves the state of the selector control.

Return Value:

Returns the combination of STATE_SYSTEM codes that best describes the state of the control.

Remarks:

The returned code contains the STATE_SYSTEM_MULTISELECTABLE flag (if the selection mode is MULTISELECT), or the STATE_SYSTEM_EXTSELECTABLE flag (if the selection mode is EXTENDSELECT).

gotFocus

public boolean gotFocus(Event e, Object o);

Responds to the selector control receiving focus.

Return Value:

Returns true if the event was handled; otherwise, returns false.

ParameterDescription
e The event posted to the control.
o The object that posted the event (always null).

keyDown

public boolean keyDown(Event e, int key);

Handles keyboard navigation for the selector control.

Return Value:

Returns true if the event was handled; otherwise, returns false.

ParameterDescription
e The event posted to the control.
key The key that has been pressed.

Remarks:

This method is called when the control has focus and a key is pressed. keyDown responds to the following key values.

Key Response
HOME, END, PAGEUP, PAGEDOWN, all ARROW keys Navigates through the items in the control.
BACKSPACE Clears the previous key pressed during an incremental type search.
ESC Stops an incremental type search.
All other keys Begins an incremental type search for a component that begins with the characters pressed (limited by a timer). If a match is found, the match component receives focus.

lostFocus

public boolean lostFocus(Event e, Object o);

Responds to the selector control losing focus.

Return Value:

Returns false.

ParameterDescription
e The event posted to the control.
o The object that posted the event (always null).

mouseDown

public boolean mouseDown(Event e, int x, int y);

Determines whether an item in the selector control was double-clicked, and if so, generates an action event for that item.

Return Value:

Returns false.

ParameterDescription
e The event posted to the control.
x The x coordinate of the event.
y The y coordinate of the event.

Remarks:

Depending on the control's selection mode, this method responds to the mouse being clicked on an item, as shown in the following table.

Selection mode Response
SINGLESELECT Selects the item at the mouse's current location and clears any previous selection. A list select event is generated.
MULTISELECT Changes the selection state of the item that is clicked, without changing the state of any other item. In a MULTISELECT control, an item is selected when it is clicked with the mouse.
EXTENDSELECT Behaves like SINGLESELECT unless there is a CTRL or SHIFT modifier. SHIFT+click extends selection to current position. CTRL+click selects or deselects the currently focused item, without affecting any other selections. CTRL-SHIFT+click is a combination of the two.

mouseDrag

public boolean mouseDrag(Event e, int x, int y);

Selects items in the selector control, according to the current selection mode.

Return Value:

Returns false.

ParameterDescription
e The event posted to the control.
x The x coordinate of the event.
y The y coordinate of the event.

Remarks:

Depending on the control's selection mode, this method responds to the mouse being dragged across an item, as shown in the following table.

Selection mode Response
SINGLESELECT Selects the item at the mouse's current location and clears any previous selection. A list select event is generated.
MULTISELECT Does nothing. In a MULTISELECT control, an item is selected when it is clicked with the mouse.
EXTENDSELECT Selects the item at the mouse's current location without clearing any previous selection. A list select event is generated.

processActionEvent

protected void processActionEvent(UIActionEvent e);

Processes action events.

Return Value:

No return value.

ParameterDescription
e The action event.

Remarks:

This method is called by processEvent and dispatches the event to a registered action listener. When overriding this method, call the super method processActionEvent to ensure the default event processing continues normally.

See Also: addActionListener

processEvent

protected void processEvent(UIEvent e);

Processes the specified event.

Return Value:

No return value.

ParameterDescription
e The event.

Remarks:

This method is invoked automatically if a listener has been registered through a call to addXXXListener. Depending on the type of event, processEvent calls one of the following methods.

Event type Method called
action event processActionEvent
item event processItemEvent
container event processContainerEvent (inherited through UIStateContainer)
focus event processFocusEvent (inherited through UIStateContainer)
key event processKeyEvent (inherited through UIStateContainer)
mouse event processMouseEvent (inherited through UIStateContainer)
mouse motion event processMouseMotionEvent (inherited through UIStateContainer)

When overriding processEvent, call the super method processEvent to ensure the default event processing continues normally.

processItemEvent

protected void processItemEvent(UIItemEvent e);

Processes item events.

Return Value:

No return value.

ParameterDescription
e The item event.

Remarks:

This method is called by processEvent and dispatches the event to a registered item listener. When overriding this method, call the super method processItemEvent to ensure the default event processing continues normally.

See Also: addItemListener

remove

public void remove(int index);

Removes the component at the specified index from the selector control, without affecting other selections.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the component to be removed. If the root node of a UITree object displays an item, this item is at index 0 and the first child item is at index 1. Otherwise, the first child item begins at index 0. For UIList and UITabList objects, the first item is always at index 0.

Remarks:

The following example shows how to remove an item from a UIList control.

UIList colors = new UIList();

// Add items to the list.
colors.add("Red");
colors.add("Blue");
add(colors);  // Add the list to the container.

// Now remove the first component.
colors.remove(0); 

Overrides:

remove(int) in UIPanel.

remove

public void remove(IUIComponent comp);

Removes the specified component from the selector control, without affecting other selections.

Return Value:

No return value.

ParameterDescription
comp The component to be removed.

Remarks:

The following example shows how to remove an item from a UIList control.

UIList colors = new UIList();

// Add items to the list.
IUIComponent c1 = colors.add("Red");
IUIComponent c2 = colors.add("Blue");
add(colors);  // Add the list to the container.

// Now remove the "Red" component.
colors.remove(c1); 

removeActionListener

public synchronized void removeActionListener(IUIActionListener l);

Removes the specified action listener. The listener no longer receives the control's action events.

Return Value:

No return value.

ParameterDescription
l The action listener to be removed.

Remarks:

This method implements removeActionListener in the IUISelector interface.

See Also: addActionListener

removeItemListener

public synchronized void removeItemListener(IUIItemListener l);

Removes the specified item listener. The listener no longer receives the control's item events.

Return Value:

No return value.

ParameterDescription
l The item listener to be removed.

Remarks:

This method implements removeItemListener in the IUISelector interface.

See Also: addItemListener

removeSelectedIndex

public void removeSelectedIndex(int index);

Deselects the component at the specified index, without affecting other selections. By default, list deselect events are not generated.

Return Value:

No return value.

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

removeSelectedIndex

public void removeSelectedIndex(int index, boolean notify);

Deselects the component at the specified index, without affecting other selections. Optionally generates list select events.

Return Value:

No return value.

ParameterDescription
index The zero-based index of the item to be deselected.
notify If true, list deselect events will be generated; otherwise, list deselect events will not be generated.

removeSelectedIndices

public void removeSelectedIndices(int indices[]);

Deselects the components at the specified indices, without affecting other selections. By default, list deselect events are not generated.

Return Value:

No return value.

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

removeSelectedIndices

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

Deselects the components at the specified indices, without affecting other selections. Optionally generates list deselect events.

Return Value:

No return value.

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

removeSelectedItem

public void removeSelectedItem(IUIComponent comp);

Deselects the specified component, without affecting other selections. By default, list deselect events are not generated.

Return Value:

No return value.

ParameterDescription
comp The component to be deselected.

removeSelectedItem

public void removeSelectedItem(IUIComponent comp, boolean notify);

Deselects the specified component, without affecting other selections. Optionally generates list deselect events.

Return Value:

No return value.

ParameterDescription
comp The component to be deselected.
notify If true, list deselect events will be generated; otherwise, list deselect events will not be generated.

removeSelectedItems

public void removeSelectedItems(IUIComponent comps[]);

Deselects the specified components, without affecting other selections. By default, list deselect events are not generated.

Return Value:

No return value.

ParameterDescription
comps An array containing the components to be deselected.

removeSelectedItems

public void removeSelectedItems(IUIComponent comps[], boolean notify);

Deselects the specified components, without affecting other selections. Optionally generates list deselect events.

Return Value:

No return value.

ParameterDescription
comps An array containing the component to be deselected.
notify If true, list deselect events will be generated; otherwise, list deselect events will not be generated.

setAnchorItem

public void setAnchorItem(IUIComponent comp);

Sets the item used as an anchor in EXTENDSELECT mode. The anchor item cannot be set to null.

Return Value:

No return value.

ParameterDescription
comp The component that will be the new anchor.

Remarks:

The anchor is set whenever you click or CTRL+click an item. When you SHIFT+click an item, all the items from the anchor to where you SHIFT+clicked are selected.

SHIFT+clickdoes not set the anchor; it sets the extension item (see setExtensionItem). Click an item to set the anchor, and then SHIFT+click above and below it; the anchor will be obvious.

Although the anchor is set when the user clicks an item, it is also possible to set the anchor programatically with setAnchorItem. You can not set the anchor item to be null.

Note Resetting the anchor automatically sets the current extension item to null. If it is intended to set both to specific items, call setAnchorItem, followed by setExtensionItem.

Setting the anchor in an IUISelector, other than the outermost one, has no effect.

Exceptions:

IllegalArgumentException if the component is not a child of the selector, or if the component is null.

See Also: setAnchorItem, setExtensionItem

setExtensionItem

public void setExtensionItem(IUIComponent comp);

Sets the item to which a selection extends from an anchor.

Note Calling setAnchorItem automatically resets this item to null.

Return Value:

No return value.

ParameterDescription
comp The component that will be the new extension item.

Exceptions:

IllegalArgumentException if comp is not a child of the selector.

setSelected

public void setSelected(boolean on);

Sets or clears the selected state of the selector control.

Return Value:

No return value.

ParameterDescription
on If true, the selected state is set; otherwise, it is cleared.

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. If the root node of a UITree object displays an item, this item is at index 0 and the first child item is at index 1. Otherwise, the first child item begins at index 0. For UIList and UITabList objects, the first item is always at index 0.

Remarks:

This method implements setSelectedIndex in the IUISelector interface, and clears any previous selection. If the control's selection mode is MULTISELECT or EXTENDSELECT, you can also call setSelectedIndices to select multiple items at a time.

For related code examples, see the UISelector overview.

See Also: setSelectedItem, addSelectedIndex, getSelectedIndex

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. If the root node of a UITree object displays an item, this item is at index 0 and the first child item is at index 1. Otherwise, the first child begins at index 0. For UIList and UITabList objects, the first item is always at index 0.
notify If true, a list select event will be generated; otherwise, a list select event will not be generated.

Remarks:

This method implements setSelectedIndex in the IUISelector interface, and clears any previous selection. If the control's selection mode is MULTISELECT or EXTENDSELECT, you can also call setSelectedIndices to select multiple items at a time.

For related code examples, see the UISelector overview.

See Also: setSelectedItem, addSelectedIndex, getSelectedIndex

setSelectedIndices

public void setSelectedIndices(int indices[]);

Sets the selection to the components at the specified indices. List select events are not generated.

Return Value:

No return value.

ParameterDescription
indices An array containing the zero-based indices of the items to be selected. If the root node of a UITree object displays an item, this item is at index 0 and the first child item is at index 1. Otherwise, the first child begins at index 0. For UIList and UITabList objects, the first item is always at index 0.

Remarks:

This method implements setSelectedIndices in the IUISelector interface, and clears any previous selection. If the control's selection mode is SINGLESELECT, you can also call setSelectedIndex.

For related code examples, see the UISelector overview.

See Also: setSelectedItems, getSelectedIndices

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 zero-based indices of the items to be selected. If the root node of a UITree object displays an item, this item is at index 0 and the first child item is at index 1. Otherwise, the first child item begins at index 0. For UIList and UITabList objects, the first item is always at index 0.
notify If true, list select events will be generated; otherwise, list select events will not be generated.

Remarks:

This method implements setSelectedIndices in the IUISelector interface, and clears any previous selection. If the control's selection mode is SINGLESELECT, you can also call setSelectedIndex.

For related code examples, see the UISelector overview.

See Also: setSelectedItems, getSelectedIndices

setSelectedItem

public void setSelectedItem(IUIComponent comp);

Sets the selection to the specified component. A list select event is not generated.

Return Value:

No return value.

ParameterDescription
comp The item to be selected.

Remarks:

This method implements setSelectedItem in the IUISelector interface, and clears any previous selection. If the control's selection mode is MULTISELECT or EXTENDSELECT, you can also call setSelectedItems to select multiple items at a time.

For related code examples, see the UISelector overview.

Exceptions:

IllegalArgumentException if the specified component is not an immediate child of the selector control.

See Also: setSelectedIndex, addSelectedItem, getSelectedItem

setSelectedItem

public void setSelectedItem(IUIComponent 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 implements setSelectedItem in the IUISelector interface, and clears any previous selection. If the control's selection mode is MULTISELECT or EXTENDSELECT, you can also call setSelectedItems to select multiple items at a time.

For related code examples, see the UISelector overview.

Exceptions:

IllegalArgumentException if the specified component is not an immediate child of the selector control.

See Also: setSelectedIndex, addSelectedItem, getSelectedItem

setSelectedItems

public void setSelectedItems(IUIComponent comps[]);

Sets the selection to the specified components. List select events are not generated.

Return Value:

No return value.

ParameterDescription
comps An array containing the items to be selected.

Remarks:

This method implements setSelectedItems in the IUISelector interface, and clears any previous selection. If the control's selection mode is SINGLESELECT, you can also call setSelectedItem.

For related code examples, see the UISelector overview.

Exceptions:

IllegalArgumentException if any component in the array is not an immediate child of the selector control.

See Also: setSelectedIndices, getSelectedItems

setSelectedItems

public void setSelectedItems(IUIComponent 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 implements setSelectedItems in the IUISelector interface, and clears any previous selection. If the control's selection mode is SINGLESELECT, you can also call setSelectedItem.

For related code examples, see the UISelector overview.

Exceptions:

IllegalArgumentException if any component in the array is not an immediate child of the selector control.

See Also: setSelectedIndices, getSelectedItems

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. Possible values include SINGLESELECT, MULTISELECT, EXTENDSELECT, or NOSELECT.

Remarks:

This method implements setSelectionMode in the IUISelector interface.

Exceptions:

IllegalArgumentException if an undefined selection mode was specified.

See Also: getSelectionMode

timeTriggered

public void timeTriggered(TimerEvent te);

Stops an incremental type search of the selector.

Return Value:

No return value.

ParameterDescription
te A TimerEvent object that describes the timer event.

Remarks:

This method implements timeTriggered in the TimerListener interface. The keyDown method starts a timer to begin an incremental type search. When the timer expires, timeTriggered is automatically invoked to stop the search.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.