Group Box

From Apache OpenOffice Wiki
Jump to: navigation, search

The group box control creates a frame to visually group other controls together, such as option buttons and check boxes. Controls can be added to the group box at any time. The group box control does not provide any container functionality for other controls, it is merely a visual control, and is always transparent. The group box contains a label embedded within the border and is set by the Label property. Apache OpenOffice uses fixed lines Horizontal/Vertical Line Control to visually subdivide a dialog into logical control groups.

  public void insertGroupBox(int _nPosX, int _nPosY, int _nHeight, int _nWidth){
      // create a unique name by means of an own implementation...
      String sName = createUniqueName(m_xDlgModelNameContainer, "FrameControl");
      // create a controlmodel at the multiservicefactory of the dialog model... 
      Object oGBModel = m_xMSFDialogModel.createInstance("");
      XMultiPropertySet xGBModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oGBModel);
      // Set the properties at the model - keep in mind to pass the property names in alphabetical order!
      new String[] {"Height", "Name", "PositionX", "PositionY", "Width"},
      new Object[] { new Integer(80), sName, new Integer(106), new Integer(114), new Integer(100)});
      // The controlmodel is not really available until inserted to the Dialog container
      m_xDlgModelNameContainer.insertByName(sName, oGBModel);
      // The following property may also be set with XMultiPropertySet but we
      // use the XPropertySet interface merely for reasons of demonstration 
      XPropertySet xGBPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oGBModel);
      xGBPSet.setPropertyValue("Label", "~My GroupBox");
  }catch ( ex){
      /* perform individual exception handling here.
       * Possible exception types are:
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages