Class: cWebMenuButton

Properties  Events  Methods    Index of Classes

The Web Framework's Button-style floating menu container

Hierarchy

cObject
---cWebObject
------cWebBaseUIObject
---------cWebBaseDEOServer
------------cWebBaseControl
---------------cWebMenuButton

Library: Web Application Class Library

Package: cWebMenuButton.pkg

Mixins: cWebBaseMenu_mixin

Description

The cWebMenuButton class is designed as a menu container for your web application's menu system.



A menu button is a compact way to host a menu system and works well in a mobile/touch web application. While the menu is not active, only a single button control is displayed. When the menu button is clicked (or touched), the first level of menu items are displayed in a floating panel.

Menu items can contain nested sub-menus. When a menu item with a sub-menu is clicked (or touched), then the sub menu will slide into view displacing the previous menu.

Typically, the menu button will display three horizontal lines (ala hamburger menu), as shown in the sample image above. The actual image displayed in the button is controlled by your web application's theme (psTheme).

Sample

This sample demonstrates a menu button with nested menu items. The top-level menu contains three items: Dashboard, Maintenance and Sign Out. The Maintenance item contains a sub-menu layer with two items: Sales Persons and Vendors.

Object oMenuButton is a cWebMenuButton
    Set piMenuHeight to 500
    
    Object oDashboard_itm is a cWebMenuItem
        Set psCaption to "Dashboard"

        Procedure OnClick
            Send NavigateBegin to oDashboard Self False
        End_Procedure
    End_Object

    Object oMaintenance_itm is a cWebMenuItem
        Set psCaption to "Maintenance"

        Object oSalesPersons_itm is a cWebMenuItem
            Set psCaption to "Sales Persons"

            Procedure OnClick
                Send NavigateBegin of oSelectSalesPerson Self False
            End_Procedure
        End_Object

        Object oVendor_itm is a cWebMenuItem
            Set psCaption to "Vendors"

            Procedure OnClick
                Send NavigateBegin of oSelectVendor Self False
            End_Procedure
        End_Object
    End_Object

    Object oSignOut_itm is a cWebMenuItem
        Set psCaption to "Sign Out"

        Procedure OnClick
            Send RequestLogOut of ghoWebSessionManager
        End_Procedure
    End_Object
End_Object  


Menu Size

Set piMenuHeight to control the maximum height of the floating panel that contains your menu items. If there are more menu items than can fit in the available space, then the menu items will be displayed in a scrolling list.

Set piMenuWidth to control the maximum width of the floating panel that contains your menu items. If a menu item is too wide to fit within the available space, then its caption will be truncated.

Object Name

The Web Framework uniquely identifies each web object via a combination of the object hierarchy (object nesting), and object name. This means that web object names must be unique within their parent (i.e. each sibling web object must have a unique name).