{***********************************************************************}
{									}
{ __AttchMnu  Attach a menu to a window 				}
{									}
{ function  __AttchMnu(  MenuPtr : _MenuPtr;				}
{		       WindowPtr : _WindowPtr) : boolean;		}
{									}
{	      MenuPtr	Pointer to the _Menu record to be altered.	}
{	      WindowPtr Pointer to the _Window in which the menu is	}
{			to appear when next displayed with __DispMnu.	}
{									}
{ Description __AttchMnu changes the  window  associated  with	a	}
{	      menu by changing the window pointer field (_MWinPtr)	}
{	      within the menu descriptor (_Menu) so that it points to	}
{	      the window specified in WindowPtr.  In this way, the	}
{	      same menu may be displayed at different places on the	}
{	      screen without constructing a new menu descriptor.	}
{									}
{	      __AttchMnu returns TRUE if the window pointer is		}
{	      successfully altered, FALSE otherwise.			}
{									}
{	      On error _MenuError may be set to:  _InvalidWindow	}
{						  _InvalidMenu		}
{									}
{ Version     4.00 (C)Copyright Blaise Computing Inc. 1987		}
{_______________________________________________________________________}

function __AttchMnu(  MenuPtr : _MenuPtr;
		    WindowPtr : _WindowPtr) : boolean;

  begin {__AttchMnu}

    __AttchMnu := FALSE;

    { The menu and window pointers must be valid, and if the menu is	}
    { displayed, a new window cannot be attached to the menu.		}

    if (ValidSig(MenuPtr,MENUSIG_)) then
       if ((not ValidWindow(WindowPtr)) or
				      (MenuPtr^._MWinPtr^._Active)) then
	  SetMenuError(_InvalidWindow)
       else
	 begin
	   MenuPtr^._MWinPtr := WindowPtr;
	   __AttchMnu := TRUE
	 end

  end;	{__AttchMnu}
