2.2.29 menu (Dynamic Menu Root XML Element)

This element specifies the root tag of the XML string returned by a dynamic menu control.

For example, consider a dynamic menu control, as follows:

A dynamic menu control

Figure 18: A dynamic menu control

This is specified using the following XML fragment:

 <dynamicMenu id="dynamic" label="Dynamic Menu" getContent="GetMenuContent" />

The GetMenuContent callback function is called when the menu is dropped, and in this case returns a string with the following XML:

 <menu xmlns="http://schemas.microsoft.com/office/2006/01/customui">
   <button id="button1" label="Button 1" />
   <button id="button2" label="Button 2" />
   <button id="button3" label="Button 3" />
 </menu>

The following table summarizes the child elements of this element.

Child Elements

Section

button (Unsized Button)

2.2.3

checkBox (Check Box)

2.2.6

control (Unsized Control Clone)

2.2.11

dynamicMenu (Unsized Dynamic Menu)

2.2.18

gallery (Unsized Gallery)

2.2.22

menu (Unsized Menu)

2.2.26

menuSeparator (Menu Separator)

2.2.30

splitButton (Unsized Split Button)

2.2.36

toggleButton (Unsized Toggle Button)

2.2.42

The following table summarizes the attributes of this element.

Attributes

Description

getTitle (getTitle callback)

Specifies the name of a callback function to be called to determine the title of this control.

The title and getTitle attributes are mutually exclusive. If neither attribute is specified no title SHOULD be shown.

For example, consider the following XML fragment:

 <menu   id="menu" label="Menu"   getTitle="GetMenuTitle">
  …
 </menu>

In this example, the GetMenuTitle callback function is to be called when the application needs to determine the title of the menu.

The possible values for this attribute are defined by the ST_Delegate simple type, as specified in section 2.3.2.

itemSize (item size)

Specifies the size of the child controls in this menu.

If this attribute is not specified, the menu's child controls SHOULD default to the normal size.

For example, consider a menu control with large menu items, as follows:

Menu control with 3 large buttons

This is specified using the following XML fragment:

 <menu   id="menu" label="Menu with large items"   itemSize="large">
     <button id="button1" label="Button 1"   imageMso="HappyFace" />
     <button id="button2" label="Button 2"   imageMso="Paste" />
     <button id="button3" label="Button 3"   imageMso="Copy" />
 </menu>

The possible values for this attribute are defined by the ST_ItemSize simple type, as specified in section 2.3.6.

title (title)

Specifies a string to be displayed as the title of the control.

The title and getTitle attributes are mutually exclusive. If neither attribute is specified, no title SHOULD be shown.

For example, consider a menu control with a title, as follows:

Menu control with a title

This is specified with the following XML fragment:

 <menu   id="menu" label="Menu With Title" title="Title   String">
     <button id="button" label="Button" />
 </menu>

The possible values for this attribute are defined by the ST_String simple type, as specified in section 2.3.11.

The following XML schema fragment defines the contents of this element:

 <xsd:complexType name="CT_MenuRoot">
    <xsd:sequence>
    <xsd:choice minOccurs="0" maxOccurs="1000">
    <xsd:group ref="EG_MenuControlsBase"/>
    <xsd:group ref="EG_MenuOrSplitButtonRegular"/>
    </xsd:choice>
    </xsd:sequence>
    <xsd:attributeGroup ref="AG_Title"/>
    <xsd:attribute name="itemSize" type="ST_ItemSize" use="optional"/>
 </xsd:complexType>