MSDN Library

TOOLBARCHECKGROUP Element | ToolbarCheckGroup Object

Adds a ToolbarCheckGroup element to a Toolbar.

Syntax

HTML <namespace:TOOLBARCHECKGROUP ... >

Possible Values

namespace Prefix that associates a custom tag with an XML namespace. This prefix is set using the XMLNS attribute of the html tag.

Remarks

The TOOLBARCHECKGROUP represents a TOOLBARCHECKBUTTON grouping. It performs the work of mutually excluding the buttons.

By default, the first TOOLBARCHECKBUTTON within the group is selected. To override this default, set the FORCESELECTION attribute on the TOOLBARCHECKGROUP to false.

This element is a block element.

This element requires a closing tag.

Members Table

The following table lists the members exposed by the ToolbarCheckGroup object.

Attributes/Properties
Attribute Property Description
DEFAULTSTYLE Sets or retrieves a value that indicates the default style for the element.
FORCESELECTION Sets or retrieves a value that indicates whether at least one ToolbarCheckButton in a ToolbarCheckGroup must be selected.
HOVERSTYLE Sets or retrieves a value that indicates the style of the element when the user hovers the keyboard focus or mouse pointer over it.
SELECTEDCHECKBUTTON SelectedCheckButton Sets or retrieves a value that indicates whether a ToolbarCheckButton within the ToolbarCheckGroup is selected as default.
SELECTEDSTYLE Sets or retrieves a value that indicates the style for the selected element.
Elements/Objects
Element Object Description
TOOLBARCHECKBUTTON ToolbarCheckButton Adds a ToolbarCheckButton element to a Toolbar.
Methods
Method Description
getAttribute Retrieves the value of the specified attribute.
getCount Retrieves the number of child ToolbarCheckButton elements of the ToolbarCheckGroup element.
getSelected Retrieves the selected item.
getType Retrieves the type of item.
remove Removes the item from the Toolbar object.
setAttribute Sets the value of the specified attribute.

Examples

The following example shows how to use the TOOLBARCHECKGROUP element to associate a group of TOOLBARCHECKBUTTON elements together inside a Toolbar.



<HTML xmlns:TOOLBAR>
<?import namespace="TOOLBAR" implementation="toolbar.htc">
<BODY>

<TOOLBAR:TOOLBAR STYLE="display:inline" ID="oToolBar">

<TOOLBAR:TOOLBARSEPARATOR />

<TOOLBAR:TOOLBARCHECKGROUP>
<TOOLBAR:TOOLBARCHECKBUTTON
TEXT="A" 
DEFAULTSTYLE="width:30px; text-align:center;font-size:large;"
HOVERSTYLE="background-color:#99CCFF;"
SELECTEDSTYLE="background-color:#003399; color:#FFFFFF"
 />
<TOOLBAR:TOOLBARCHECKBUTTON
TEXT="B" 
DEFAULTSTYLE="width:30px; text-align:center;font-size:large;"
HOVERSTYLE="background-color:#99CCFF;"
SELECTEDSTYLE="background-color:#003399; color:#FFFFFF"
 />
 </TOOLBAR:TOOLBARCHECKGROUP>
 
<TOOLBAR:TOOLBARSEPARATOR />
</TOOLBAR:TOOLBAR> 

</BODY>
</HTML>


Code example: http://samples.msdn.microsoft.com/workshop/samples/webcontrols/toolbar/toolbarCheckGroup.htm

The following example shows how to access the child TOOLBARCHECKBUTTON objects of the TOOLBARCHECKGROUP objects and retrieve information from them.



<HTML xmlns:TOOLBAR>
<?import namespace="TOOLBAR" implementation="toolbar.htc">
<HEAD>
<SCRIPT>
function fnCheck()
{
    // Retrieve number of top-level items
    var nTopItems = oToolBar.numItems;
    // Check each item to see if it is a toolbarCheckGroup item
    var i, oSelectedCheckbox;
    for(i=0; i<nTopItems; i++)
    {
        var oItem = oToolBar.getItem(i);
        if(oItem.getType()== "checkgroup")
        {
           // Retrieve number of checkbuttons in checkgroup
           var nCheckButtons = oItem.getCount();
           // Display the text of each checkbutton in the checkgroup
           var j;
           for(j=0; j<nCheckButtons; j++)
           {
               var oCheckButton = oItem.getItem(j);
               alert("CheckButton Text: " + oCheckButton.getAttribute("text"));
           }
           oSelectedCheckbox = oItem.getSelected();
           if(oSelectedCheckbox != null)
               alert("You selected the checkbutton with " + oSelectedCheckbox.getAttribute("text") + " text!");
           else
               alert("You did not select a checkbox!");
        }
    }
	
}

</SCRIPT>
</HEAD>

<BODY>

<TOOLBAR:TOOLBAR STYLE="display:inline" ID="oToolBar">
<TOOLBAR:TOOLBARSEPARATOR />

<TOOLBAR:TOOLBARCHECKGROUP>
<TOOLBAR:TOOLBARCHECKBUTTON
TEXT="A" 
DEFAULTSTYLE="width:30px; text-align:center;font-size:large;"
HOVERSTYLE="background-color:#99CCFF;"
SELECTEDSTYLE="background-color:#003399; color:#FFFFFF"
 />
<TOOLBAR:TOOLBARCHECKBUTTON
TEXT="B" 
DEFAULTSTYLE="width:30px; text-align:center;font-size:large;"
HOVERSTYLE="background-color:#99CCFF;"
SELECTEDSTYLE="background-color:#003399; color:#FFFFFF"
 />
</TOOLBAR:TOOLBARCHECKGROUP>

<TOOLBAR:TOOLBARSEPARATOR />
<TOOLBAR:TOOLBARBUTTON ONCLICK= "fnCheck();" TEXT="Check CheckButtonGroup" />
</TOOLBAR:TOOLBAR> 
</BODY>
</HTML>

Code example: http://samples.msdn.microsoft.com/workshop/samples/webcontrols/toolbar/toolbarCheckGroup2.htm

Applies To

TOOLBAR

See Also

Show:
© 2016 Microsoft