[]
        
(Showing Draft Content)

IControl

Interface IControl

All Known Subinterfaces:
IButton, ICellLinkControl, ICellLinkControlT<T>, ICheckBox, IContentControl, IControlT<T>, IDropDown, IGroupBox, ILabel, IListBox, IOptionButton, IRangeBase, IScrollBar, ISelector, ISelectorT<T,TCollection>, ISpinner

public interface IControl
Represents the base interface for form controls.

This interface defines the common members shared by form controls such as buttons, check boxes, drop-down lists, labels, and scroll bars. Use it to access shared control state and behavior, including the parent object, control type, position, size, visibility, printing, and locking settings.

The parent object is typically an IWorksheet, but in some cases it can be another IControl.


 IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
 FormControlType type = control.getFormControlType();
 Object parent = control.getParent();
 control.setEnabled(false);
 
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Changes the z-index of this control to the front.
    void
    Remove this control from parent.
    Gets the bottom right cell of this control.
    boolean
    Gets whether the control is enabled.
    Returns the form control type of this control.
    double
    Gets the height of this control.
    double
    Gets the left margin of this control.
    boolean
    Gets whether the control is locked.
    Gets the name of this control.
    Gets the parent object, typically IWorksheet.
    Gets the way a control is attached to its underlying cells.
    boolean
    Gets whether the control will be printed.
    Gets the shapes of this control.
    double
    Gets the top margin of this control.
    Gets the top left cell of this control.
    boolean
    Gets whether the control is visible.
    double
    Gets the width of this control.
    int
    Gets the z-index of this control.
    boolean
    Sends the control to the back of the z-order.
    void
    setEnabled(boolean value)
    Sets whether the control is enabled.
    void
    setHeight(double value)
    Sets the height of this control.
    void
    setLeft(double value)
    Sets the left margin of this control.
    void
    setLocked(boolean value)
    Sets whether the control is locked.
    void
    setName(String value)
    Sets the name of this control.
    void
    Sets the way a control is attached to its underlying cells.
    void
    setPrintObject(boolean value)
    Sets whether the control will be printed.
    void
    setTop(double value)
    Sets the top margin of this control.
    void
    setVisible(boolean value)
    Sets whether the control is visible.
    void
    setWidth(double value)
    Sets the width of this control.
  • Method Details

    • getParent

      Object getParent()
      Gets the parent object, typically IWorksheet.

      In some cases, the type of this property is IControl.

      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       IWorksheet parentWorksheet = (IWorksheet) control.getParent();
       
      Returns:
      The parent object. Typically returns an IWorksheet; in some cases, returns an IControl.
    • getFormControlType

      FormControlType getFormControlType()
      Returns the form control type of this control.

      Use the returned FormControlType value to identify the concrete kind of control represented by this IControl, such as a button, check box, drop-down list, label, or scroll bar.

      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       FormControlType type = control.getFormControlType();
       
      Returns:
      The FormControlType value that identifies this control.
    • getEnabled

      boolean getEnabled()
      Gets whether the control is enabled.
      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setEnabled(false);
       boolean enabled = control.getEnabled();
       
      Returns:
      true if the control is enabled; otherwise, false.
      API Note:
      Not supported by the *.ssjson format.
    • setEnabled

      void setEnabled(boolean value)
      Sets whether the control is enabled.
      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setEnabled(false);
       
      Parameters:
      value - true if the control is enabled; otherwise, false.
      API Note:
      Not supported by the *.ssjson format.
    • getHeight

      double getHeight()
      Gets the height of this control.

      Use this method to retrieve the current height of a form control, such as after creating it or changing it with setHeight(double).

      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setHeight(40);
       double height = control.getHeight();
       
      Returns:
      The height of this control.
    • setHeight

      void setHeight(double value)
      Sets the height of this control.
      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setHeight(40);
       
      Parameters:
      value - The height of this control.
    • getLeft

      double getLeft()
      Gets the left margin of this control.

      Use this method to retrieve the current horizontal offset of the control.

      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setLeft(40);
       double left = control.getLeft();
       
      Returns:
      The left margin of this control.
    • setLeft

      void setLeft(double value)
      Sets the left margin of this control.

      Use this method to set the horizontal offset of the control.

      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setLeft(40);
       
      Parameters:
      value - The left margin of this control.
    • getLocked

      boolean getLocked()
      Gets whether the control is locked.

      Use this method to determine whether the control is configured to reject user input. To change this state, use setLocked(boolean).

      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setLocked(true);
       boolean locked = control.getLocked();
       
      Returns:
      true if the control is locked; otherwise, false.
      API Note:
      Not supported by the *.ssjson format.
    • setLocked

      void setLocked(boolean value)
      Sets whether the control is locked.
      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setLocked(true);
       
      Parameters:
      value - true if the control is locked; otherwise, false.
      API Note:
      Not supported by the *.ssjson format.
    • getPlacement

      Placement getPlacement()
      Gets the way a control is attached to its underlying cells.

      The returned Placement value determines whether the control moves with cells, moves and resizes with cells, or remains free floating.

      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setPlacement(Placement.Move);
       Placement placement = control.getPlacement();
       
      Returns:
      The Placement value that specifies how the control is attached to its underlying cells.
    • setPlacement

      void setPlacement(Placement value)
      Sets the way a control is attached to its underlying cells.

      Use this method to control whether the form control moves or resizes when the underlying cells are moved or resized.

      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setPlacement(Placement.MoveAndSize);
       
      Parameters:
      value - The placement mode to apply, such as Placement.MoveAndSize, Placement.Move, or Placement.FreeFloating.
    • getPrintObject

      boolean getPrintObject()
      Gets whether the control will be printed.

      Use this property to determine whether the control is included when the worksheet is printed.

      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setPrintObject(false);
       boolean printObject = control.getPrintObject();
       
      Returns:
      true if the control will be printed; otherwise, false.
    • setPrintObject

      void setPrintObject(boolean value)
      Sets whether the control will be printed.

      Use this property to set whether the control is included when the worksheet is printed.

      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setPrintObject(false);
       
      Parameters:
      value - true if the control will be printed; otherwise, false.
    • getTop

      double getTop()
      Gets the top margin of this control.
      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setTop(40);
       double top = control.getTop();
       
      Returns:
      The top margin of this control.
    • setTop

      void setTop(double value)
      Sets the top margin of this control.
      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setTop(40);
       
      Parameters:
      value - The top margin of this control.
    • getVisible

      boolean getVisible()
      Gets whether the control is visible.

      Use this property to determine whether the control is currently displayed on the worksheet.

      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setVisible(false);
       boolean visible = control.getVisible();
       
      Returns:
      true if the control is visible; otherwise, false.
    • setVisible

      void setVisible(boolean value)
      Sets whether the control is visible.

      Use this property to set whether the control is currently displayed on the worksheet.

      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setVisible(false);
       
      Parameters:
      value - true if the control is visible; otherwise, false.
    • getWidth

      double getWidth()
      Gets the width of this control.

      Use this method to retrieve the current width after the control is created or resized by setWidth(double).

      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setWidth(160.0);
       double width = control.getWidth();
       
      Returns:
      The current width of this control.
    • setWidth

      void setWidth(double value)
      Sets the width of this control.

      Use this method to set the width after the control is created or resized by IControl#setWidth(double).

      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setWidth(160.0);
       
      Parameters:
      value - The current width of this control.
    • getZOrder

      int getZOrder()
      Gets the z-index of this control.

      Use this method to retrieve the stacking position of the control relative to other controls on the worksheet. The returned value can change after calling bringToFront() or sendToBack().

      
       IControl control1 = worksheet.getControls().addButton(20, 20, 120, 30);
       IControl control2 = worksheet.getControls().addButton(40, 40, 120, 30);
       control2.bringToFront();
       int zOrder = control2.getZOrder();
       
      Returns:
      The z-index of this control.
    • getShapeRange

      IShapeRange getShapeRange()
      Gets the shapes of this control.

      Returns the IShapeRange associated with the control so you can access the underlying shape objects.

      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       IShapeRange shapeRange = control.getShapeRange();
       int count = shapeRange.getCount();
       
      Returns:
      The IShapeRange that contains the shapes of this control.
    • bringToFront

      boolean bringToFront()
      Changes the z-index of this control to the front.

      Use this method to place the control in front of other overlapping form controls on the same parent.

      
       IButton button1 = worksheet.getControls().addButton(20, 20, 80, 24);
       IButton button2 = worksheet.getControls().addButton(30, 24, 80, 24);
       boolean moved = button1.bringToFront();
       
      Returns:
      true if the control is brought to the front; otherwise, false.
    • delete

      void delete()
      Remove this control from parent.

      Use this method to remove the current control from its parent object, such as a worksheet or another control container.

      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setName("submitButton");
       control.delete();
       
    • sendToBack

      boolean sendToBack()
      Sends the control to the back of the z-order.

      Use this method to place the control behind other overlapping form controls on the same parent.

      
       IControl control1 = worksheet.getControls().addButton(20, 20, 120, 30);
       IControl control2 = worksheet.getControls().addButton(30, 24, 120, 30);
       boolean moved = control2.sendToBack();
       
      Returns:
      true if the control's z-order position changes successfully; otherwise, false.
    • getBottomRightCell

      IRange getBottomRightCell()
      Gets the bottom right cell of this control.

      Returns the worksheet cell at the lower-right corner of the area occupied by the control.

      
       IButton button = worksheet.getControls().addButton(20, 20, 80, 24);
       IRange cell = button.getBottomRightCell();
       String address = cell.getAddress();
       
      Returns:
      The bottom right cell of this control.
    • getName

      String getName()
      Gets the name of this control.

      Use this method to retrieve the identifier assigned to the control, for example after calling setName(String).

      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setName("SubmitButton");
       String name = control.getName();
       
      Returns:
      The name of this control.
    • setName

      void setName(String value)
      Sets the name of this control.
      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       control.setName("SubmitButton");
       
      Parameters:
      value - The name of this control.
    • getTopLeftCell

      IRange getTopLeftCell()
      Gets the top left cell of this control.

      The returned IRange identifies the worksheet cell at the upper-left corner of the control.

      
       IControl control = worksheet.getControls().addButton(20, 20, 120, 30);
       IRange cell = control.getTopLeftCell();
       String address = cell.getAddress();
       
      Returns:
      The top left cell of this control.