GWMenuItems

Enumerates the items on a menu. The menu items collection maintains references to the commands placed on the menu (GWMenuItems::Add). When the corresponding GWMenu is destroyed, the GWCommand objects placed on the menu are released.

Properties

The following table lists the properties for this class, along with access and descriptions.

Property

Access

Description

Count

R/O

Long.

Parent

R/O

GWMenu.

_NewEnum

R/O

Enumeration object Implements IEnumVARIANT. Fo×r Windows only.

Methods

GWMenuAction Add( String caption, GWCommand item [,Variant AddBefore] )
GWMenu AddMenu( String caption [, GWCommand item ] [, Variant AddBefore] )
GWMenuSeparator AddSeparator( [ Variant AddBefore] )
GWMenuItem Item( Variant item )
GWMenuItem FindByHMenu( Long hMenu )
GWMenuItem FindByID( Variant ID )

Remarks

C3PO software generally adds items to (or remove them from) the menu while calling the CommandFactory methods, such as CustomizeMenu. In this case the C3PO does not redraw the menu bar. However, if the C3PO maintains a reference to GWMenuItems and adds (or removes) items at another time, there is no guarantee that the menu bar will be redrawn properly.

The Item and AddBefore parameters do not allow you to specify a persistent ID. The workaround is to call FindByID method to obtain GWMenuItem, then pass the menu ID or display string available from that object into the Item method or as the AddBefore parameter.