Class: cWebMenuGroup

Properties  Events  Methods    Index of Classes

The Web Framework dynamic menu group provider

Hierarchy

cObject
---cWebObject
------cWebMenuGroup

Library: Web Application Class Library

Package: cWebMenuGroup.pkg

Description

The Web Framework's menu system works with menu providers (classes that can contain/define a menu) and menu listeners (classes that render a menu). Most menu classes are both provider and listener and the menus are defined by nested menu item objects (cWebMenuItem).

The cWebMenuGroup class is a specialized menu provider which is used to define a menu separately from the object that will display the menu.

The psGroupName property is used to connect a menu group with the object that is intended to display that menu, e.g. an action bar (cWebActionBar) with a matching psGroupName.

When a menu group is placed inside a view it activates when the view is visible and deactivates if the view is not visible. While active the menu group's menu items are appended to the matching menu listener and removed when the menu group is deactivated.

The default templates and wizards used for creating a mobile/touch style web application will create a global action bar object (cWebActionBar) and a menu group in each view which controls the items that are displayed in the action bar.

Sample

The sample below shows a view (oZoomCustomer) which contains an action group. When the view is displayed the action group's menu items are appended to all menu listener objects that have a psGroupName matching the ID "MyActions".

Object oZoomCustomer is a cWebView
    Set peViewType to vtZoom 
    Set psCaption to "Customer Maintenance"
    //
    // child DDO and DEO objects not shown
    //
    
    Object oActionGroup is a cWebMenuGroup
        Set psGroupName to "MyActions"

        Object oSaveBtn is a cWebMenuItem
            Set psCaption to "Save"
            Set psCSSClass to "WebSaveMenuItem"
        
            Procedure OnClick
                Send Request_Save
            End_Procedure
        End_Object
        
        Object oEditBtn is a cWebMenuItem
            Set psCaption to "Edit"
            Set psCSSClass to "WebEditMenuItem"
            Procedure OnClick
                Send ChangeEditMode True
                Send SetActionButtons
            End_Procedure
        End_Object 
        
        Object oDeleteBtn is a cWebMenuItem
            Set psCaption to "Delete"
            Set psCSSClass to "WebDeleteMenuItem"
            Set peActionDisplay to adMenu            
            
            Procedure OnClick
                Send Request_Delete
            End_Procedure
        End_Object
    End_Object
End_Object


Group Name

Set psGroupName to identify the host menu listener objects (e.g. cWebActionBar) that will display the menu group's items. The default group name for menu group and action bar objects is "MainActions".

If your web application only contains one action bar (cWebActionBar), then you do not need to set psGroupName.