A window menu is attributed to a window using the WindSet() function (as AES philosophy). First of all, create the window with the WindCreate() function and get the menu address. Then use the WindSet() function with WF_MENU option.
Here a typical example :
{ OBJECT *menu; WINDOW *win; win = WindCreate( NAME|MOVER|CLOSER, app.x, app.y, app.w, app.h); rsrc_gaddr( 0, MENU1, &tree); WindSet( win, WF_MENU, tree, NULL); WindOpen( win, -1, -1, 400, 200); }A menu can be removed by the call :
WindSet( win, WF_MENU, NULL);All menus attributed to a window are duplicated in memory ( WindSet() uses the ObjcDup() function).
Desktop menu
The desktop menu is declared with the function MenuBar(). A typical example is :
main() { OBJECT *menu; ApplInit(); RsrcLoad( "resource.rsc"); rsrc_gaddr( 0, MYMENU, &menu); MenuBar( menu, 1); ... }