共用方式為


dialog element 

Specifies text, buttons, and possibly a single image to be displayed on a page that requires a response from the user.

Element Information

Element type: xsd:complexType

Namespace: https://schemas.microsoft.com/sideshow/2006/scf

Schema name: Simple Content Format

Elements and Attributes

Parent Elements

body element

Child Elements

txt element

btn element

Attributes

Attribute

Type

Required

Description

Possible values

id

xsd:positiveInteger

Required

The content identifier of the current page.

The actual content identifier of the current page.

title

xsd:string

Optional

The title to be displayed in the title bar or at the top of the page.

Any valid string. If not specified, the gadget name will be used.

imgid

xsd:positiveInteger

Optional

The content identifier of binary image data to be displayed as part of the dialog page.

Devices may ignore the setting of this property.

Any positive integer that corresponds to the content identifier of the relevant binary image data.

Remarks

The dialog element uses the DialogChild group element to specify an unbounded sequence of child elements consisting of any combination of the child elements: txt and btn, but containing at least one of each of these child elements.

When displaying a dialog page, a device may choose to render the button mappings directly on the screen as soft buttons, rendering the text content of the btn element as the button title. In this scenario, the hardware buttons navigate among the soft buttons, as opposed to being mapped directly to an action as specified in a btn element.

The button assigned to the ENTER key—which is one of the possible values of the ButtonKey simpleType that defines the type of the key attribute of the btn element—is the default button when the dialog page is shown. If no button is assigned to the ENTER key, then the first button specified is the default button.

Usage Example

The following code example displays an alert message by using a dialog element.

<body>
    <dialog id="300" title="Power Alert" imgid="1000">
        <txt align="l">Microsoft Windows has detected that your battery is running low. Would you like to go into hibernate?</txt>
        <btn key="Enter" target="10">Yes</btn>
        <btn key="Back" target="11">No</btn>
    </dialog>
</body>

Schema Definition

The following schema defines a dialog to display the alert message.

<xsd:element name="dialog">
    <xsd:complexType>
        <xsd:group ref="DialogChild" maxOccurs="unbounded" />
        <xsd:attribute name="id" type="xsd:positiveInteger" use="required" />
        <xsd:attribute name="title" type="xsd:string" use="optional" />
        <xsd:attribute name="imgid" type="xsd:positiveInteger" use="optional" />
    </xsd:complexType>
    <xsd:unique name="UniqueButtonKeyDialog">
        <xsd:selector xpath="./btn" />
        <xsd:field xpath="@key" />
    </xsd:unique>
</xsd:element>

<xsd:group name="DialogChild">
    <xsd:choice>
        <xsd:element ref="txt" minOccurs="1" />
        <xsd:element ref="btn" minOccurs="1" />
    </xsd:choice>
</xsd:group>

See Also

Concepts

body element
content element
menu element
txt element
btn element