Creating Submenus

You can create submenus by adding a menu to a menu item, and then add more menu items to the menu. The code in Listing 9.2 shows how you can create submenus.

Listing 9.2. Using submenus
<canvas>
    <menubar>
        <menu text="File" width="100">

            <menuitem text="New"/>
            <menuitem text="Open">
                <menu>
                    <menuitem text="From File"/>
                    <menuitem text="From the Internet"/>
                </menu>
            </menuitem>
            <menuitem text="Save"/>
            <menuseparator/>
            <menuitem text="Exit"/>
        </menu>
        <menu text="Help" width="100">
            <menuitem text="About"/>
        </menu>
    </menubar>
</canvas>

To test the application, use this URL:

http://localhost:8080/lps-4.0.x/app09/menuTest2.lzx

Figure 9.3 shows the result.

Figure 9.3. Using submenus


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset