OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Creating Menu Groups in Menu Resources

The TMenuDescr class provides two ways to set up the groups that your various pop-up menus belong in:

  • Explicitly numbering the menu resources in the TMenuDescr constructor
  • Placing separators at the pop-up menu level in the menu resource

Earlier versions of ObjectWindows provided only the first method. The second method is new in ObjectWindows 2.5 . This method is more flexible, eliminating the need to modify the TMenuDescr constructor whenever you add or remove a pop-up menu in your menu resource.

To set up groups in your menu resource, put separators at the pop-up menu level, outside the pop-up definitions. These separators have meaning only to the TMenuDescr constructor and do not cause any changes in the appearance of your menu bar. Separators inside pop-up menus are treated normally: They appear in the pop-up menu as separator bars between menu choices.

The following example shows how a menu resource might be divided up into groups using separators in the menu resource. The menu resource is divided up into the requisite six groups, with four of the groups containing actual pop-up menus: the File menu, the Edit menu, the Window menu, and the Help menu. The other two groups are empty.

{
POPUP "File"
{
MENUITEM "&New\aCtrl+N", CM_FILENEW
MENUITEM "&Open\aCtrl+O", CM_FILEOPEN
MENUITEM "&Save\aCtrl+S", CM_FILESAVE
MENUITEM "Save &as...", CM_FILESAVEAS
MENUITEM "&Print\aCtrl+P", CM_FILEPRINT
}
POPUP "&Edit"
{
MENUITEM "&Undo\aCtrl+Z", CM_EDITUNDO
MENUITEM "&Cut\aCtrl+X", CM_EDITCUT
MENUITEM "C&opy\aCtrl+C", CM_EDITCOPY
MENUITEM "&Paste\aCtrl+V", CM_EDITPASTE
MENUITEM "&Delete\aDel", CM_EDITDELETE
}
POPUP "&Window"
{
MENUITEM "Arrange &Icons", CM_ARRANGEICONS
MENUITEM "C&lose All", CM_CLOSECHILDREN
MENUITEM "Add &View", CM_VIEWCREATE
}
POPUP "&Help"
{
MENUITEM "&About", CM_ABOUT
}
}

See Also