[]
ICellLinkControl, ICellLinkControlT<Integer>, IControlIDropDown, IListBox, ISelectorT<T,TCollection> This interface provides the common selection members for controls such as IDropDown and IListBox. A selector can populate its choices from ISelectorT.getItems() or bind them to a worksheet range through getItemsSourceRange() and setItemsSourceRange(IRange). When an items source range is set, the items collection is read-only. Through the inherited cell-link members, the current selection value is exposed as getSelectedIndex() plus 1.
ISelector selector = worksheet.getControls().addDropDown(20, 20, 120, 20);
worksheet.getRange("A1:A3").setValue(new Object[][] {{"Pending"}, {"Approved"}, {"Rejected"}});
selector.setItemsSourceRange(worksheet.getRange("A1:A3"));
selector.setSelectedIndex(1);
intvoidsetItemsSourceRange(IRange value) voidsetSelectedIndex(int value) getDisplay3DShading, getLinkedCell, setDisplay3DShading, setLinkedCellgetValue, setValuebringToFront, delete, getBottomRightCell, getEnabled, getFormControlType, getHeight, getLeft, getLocked, getName, getParent, getPlacement, getPrintObject, getShapeRange, getTop, getTopLeftCell, getVisible, getWidth, getZOrder, sendToBack, setEnabled, setHeight, setLeft, setLocked, setName, setPlacement, setPrintObject, setTop, setVisible, setWidthThis property can't be used if items were added to ISelectorT.getItems(). When an items source range is set, the control reads its items from that worksheet range instead of from the items collection.
This property doesn't handle #REF! errors. #REF! will be treated as an empty collection.
ISelector selector = worksheet.getControls().addDropDown(20, 20, 120, 20);
worksheet.getRange("A1:A3").setValue(new Object[][] {{"Pending"}, {"Approved"}, {"Rejected"}});
selector.setItemsSourceRange(worksheet.getRange("A1:A3"));
IRange range = selector.getItemsSourceRange();
null if no items source range is set.This property can't be used if items were added to ISelectorT.getItems(). When an items source range is set, the control reads its items from that worksheet range instead of from the items collection. Passing null clears the current items source range.
This property doesn't handle #REF! errors. #REF! will be treated as an empty collection.
ISelector selector = worksheet.getControls().addDropDown(20, 20, 120, 20);
worksheet.getRange("A1:A3").setValue(new Object[][] {{"Pending"}, {"Approved"}, {"Rejected"}});
selector.setItemsSourceRange(worksheet.getRange("A1:A3"));
value - The worksheet range that provides the items for this control, or null to clear the current items source range.Returns the zero-based index of the currently selected item. Returns -1 if no item is selected.
ISelector selector = worksheet.getControls().addDropDown(20, 20, 120, 20);
worksheet.getRange("A1:A3").setValue(new Object[][] {{"Pending"}, {"Approved"}, {"Rejected"}});
selector.setItemsSourceRange(worksheet.getRange("A1:A3"));
selector.setSelectedIndex(1);
int selectedIndex = selector.getSelectedIndex();
-1 if no item is selected.IndexOutOfBoundsException if items are lost.Sets the zero-based index of the currently selected item. Sets -1 if no item is selected.
ISelector selector = worksheet.getControls().addDropDown(20, 20, 120, 20);
worksheet.getRange("A1:A3").setValue(new Object[][] {{"Pending"}, {"Approved"}, {"Rejected"}});
selector.setItemsSourceRange(worksheet.getRange("A1:A3"));
selector.setSelectedIndex(1);
value - The zero-based selected index of this control, or -1 if no item is selected.IndexOutOfBoundsException if items are lost.