Button Group Form Control

The oxy_buttonGroup built-in form control is used for a graphical user interface group of buttons that invokes one of several custom Author mode actions (defined in the associated Document Type) referencing it by its ID, or directly in the CSS.

The oxy_buttonGroup form control supports the following properties:

  • actionIDs - The IDs of the actions that will be presented in the group of buttons.
  • actionID - The ID of the action, specified in the associated document type framework, that is invoked when you click the button.

    Note

    The element that contains the form control represents the context where the action is invoked.
  • action_list - Defines a list of actions directly, rather than using the actionID parameter to reference actions from the associated document type framework. This property is defined using the oxy_action_list function.

    oxy_buttonGroup(
        label, 'A group of actions', 
        icon, url('http://www.oxygenxml.com/img/icn_oxy20.png'),
        actions, 
          oxy_action_list(
              oxy_action(
                    name, 'Insert', 
                    description, 'Insert an element after the current one', 
                    operation, 'InsertFragmentOperation', 
                    arg-fragment, '<element></element>',
                    arg-insertLocation, '.',
                    arg-insertPosition, 'After'
              ),
              oxy_action(
                    name, 'Delete', 
                    description, 'Deletes the current element', 
                    operation, 'DeleteElementOperation' 
              )
          )
      )

    Tip

    A code template is available to make it easy to add the oxy_action_list function.
  • label - Specifies the label to be displayed on the button. This label can be translated using the ${i18n()} editor variable.
  • icon - The path to the icon to be displayed on the button.
  • actionContext - Specifies the context in which the action associated with the form control is executed. Its possible values are element (default value) and caret. If you select the element value, the context is the element that holds the form control. If you select the caret value, the action is invoked at the cursor location. If the cursor is not inside the element that holds the form control, the element value is selected automatically.
  • visible - Specifies whether or not the form control is visible. The possible values of this property are true (default value) and false.
  • actionStyle - Specifies what to display for an action in the form control. The values of this property can be text (default value), icon, or both.
  • tooltip - Specifies a tooltip to be displayed when you hover over the form control.
  • transparent - Makes the button transparent without any borders or background colors. The values of this property can be true or false.
  • fontInherit - This value specifies whether or not the form control inherits its font from its parent element. The values of this property can be true or false (default value). To make the form control inherit its font from its parent element, set the fontInherit property to true.
  • enableInReadOnlyContext - To enable button form controls or groups of buttons form controls this property needs to be set to true. This property can be used to specify areas as read-only (by setting the -oxy-editable property to false). This is useful when you want to use an action that does not modify the context.
  • hoverPseudoclassName - Allows you to change the way an element is rendered when you hover over a form control. The value is the name of a CSS pseudo-class. When you hover over the form control, the specified pseudo-class will be set on the element that contains the form control.
    p:before {
      content: oxy_buttonGroup(hoverPseudoclassName, 'showBorder')
    }
    p:showBorder {
      border: 1px solid red;
    }

Button Group Form Control

buttongroup:before {     
  content:        
    oxy_label(text, "Button Group:", width, 150px, text-align, left)        
    oxy_buttonGroup(
       label, 'A group of actions',
       /* The action IDs are declared in the document type 
          associated with the XML document. */
       actionIDs, 
          "insert.popupWithMultipleSelection,insert.popupWithSingleSelection",
       actionStyle, "both"); 
} 

Tip

To insert a sample of the oxy_buttonGroup form control in a CSS file ,, invoke the Content Completion Assistant by pressing Ctrl + Space (Command + Space on OS X) and select the oxy_buttonGroup code template. Also, an oxy_buttonGroup_in_place_action code template is available that inserts an oxy_buttonGroup function that includes an oxy_action_list function.

To see more detailed examples and more information about how form controls work in Oxygen XML Editor plugin, see the sample files in the following directory: [OXYGEN_INSTALL_DIR]/samples/form-controls.

Was this helpful?