[]
        
(Showing Draft Content)

IOptionButton

Interface IOptionButton

All Superinterfaces:
ICellLinkControl, ICellLinkControlT<Boolean>, IContentControl, IControl, IControlT<IOptionButton>

public interface IOptionButton extends IControlT<IOptionButton>, IContentControl, ICellLinkControlT<Boolean>
Represents an option button control.

An option button lets users select a single choice from a group of mutually exclusive options. Option buttons are grouped by the containing IGroupBox. Option buttons in the same group share the linked cell value and update each other's selection state. If an option button is not contained in any group box, it belongs to the default group on the worksheet.


 IGroupBox groupBox = worksheet.getControls().addGroupBox(20, 20, 120, 80);
 groupBox.setText("Shipping");
 IOptionButton standard = worksheet.getControls().addOptionButton(30, 40, 90, 18);
 standard.setText("Standard");
 standard.setLinkedCell(worksheet.getRange("B1"));
 standard.setIsChecked(true);
 
  • Method Details

    • getGroupBox

      IGroupBox getGroupBox()
      Gets the first group box that contains the option button.

      Option buttons in the same group box are in the same group. If this method returns null, the option button belongs to the default group.

      Option buttons in the same group share the value of the ICellLinkControl.LinkedCell property. They also affect the selection state of other option buttons in the same group.

      
       IOptionButton optionButton = worksheet.getControls().addOptionButton(22.2, 24.6, 109.2, 16.8);
       IGroupBox groupBox = worksheet.getControls().addGroupBox(7.8, 6, 196.8, 122.4);
       groupBox.setText("Choices");
       IGroupBox parentGroup = optionButton.getGroupBox();
       String text = parentGroup.getText();
       
      Returns:
      The first group box that contains the option button, or null if the option button is in the default group.
      API Note:
      Maintaining the state of this property is expensive. Avoid placing too many group boxes and option buttons in the same worksheet.
    • getIsChecked

      boolean getIsChecked()
      Gets whether the IOptionButton is checked.

      For option buttons in the same group, a checked state indicates the currently selected option in that group.

      
       IOptionButton optionButton = worksheet.getControls().addOptionButton(20, 20, 72, 18);
       optionButton.setIsChecked(true);
       boolean isChecked = optionButton.getIsChecked();
       
      Returns:
      false if the option button is unchecked; otherwise, true.
    • setIsChecked

      void setIsChecked(boolean value)
      Sets whether the IOptionButton is checked.

      For option buttons in the same group, a checked state indicates the currently selected option in that group.

      
       IOptionButton optionButton = worksheet.getControls().addOptionButton(20, 20, 72, 18);
       optionButton.setIsChecked(true);
       
      Parameters:
      value - False - Unchecked, true - Checked.