Documentation Archive Developer
Search

ADC Home > Reference Library > Technical Q&As > Carbon > Human Interface Toolbox >

Adding an automated Window menu to your application


Q: Can I add an automated Window menu to my application?

A: Yes, and there are two different ways to achieve this automated functionality:

1) you just use the CreateStandardWindowMenu API the following way:

MenuRef windMenuRef;

CreateStandardWindowMenu(0, &windMenuRef);

InsertMenu(windMenuRef, 0);

This will add a Window menu at the end of your menu list;

or

2) you add two consecutive menu items (divider lines would be recommended) in one of your own menus and you set the command IDs of those two menu items to kHICommandWindowListSeparator and kHICommandWindowListTerminator this way:

SetMenuItemCommandID(theMenuRef, kStartOfWindowList, kHICommandWindowListSeparator);

SetMenuItemCommandID(theMenuRef, kStartOfWindowList+1, kHICommandWindowListTerminator);

In both cases, the Window Manager will interact with the Menu Manager (and vice versa) to manage the menu items associated with your windows.

Furthermore, if you wish the kHICommandWindowListSeparator and/or kHICommandWindowListTerminator menu items to be hidden rather than be divider lines, you can set their attribute to kMenuItemAttrHidden with the ChangeMenuItemAttributes API.

NB. kHICommandWindowListSeparator and kHICommandWindowListTerminator are defined in the Universal Interfaces 3.4.1.


[Oct 30 2001]