{***********************************************************************}
{									}
{ __RetItMnu Return a pointer to a menu item				}
{									}
{ function __RetItMnu(MenuPtr : _MenuPtr; Col,Row : byte) :_ItemPtr;	}
{									}
{	      MenuPtr	Pointer to the menu descriptor returned by	}
{			__MakeMnu when the menu was constructed.	}
{	      Col,Row	Item's position within the window		}
{									}
{ Description This function finds a particular _Item in the linked	}
{	      list of _Items for a menu, based on its unitque		}
{	      row, column coordinates.	It returns a pointer to the	}
{	      selected item, or NIL if no match is found.		}
{									}
{	      By obtaining the pointer to an item, you can access	}
{	      he various fields of the _Item record by dereferencing	}
{	      the pointer, for example: 				}
{									}
{		IPtr := __RetItMnu(MenuPtr,1,4);			}
{		if (IPtr <> NIL) then					}
{		  IPtr^._Protect := TRUE;				}
{									}
{	      This code fragment returns the pointer to the menu item	}
{	      located at column 1, row 4 of the menu referenced by	}
{	      MenuPtr, then 'protects' the item (the item will be dis-	}
{	      played with protected attributes and may not be selected	}
{	      when the menu is read).  NOTE:  DO NOT use this method to }
{	      modify the strings pointed to by the _ItemStrPtr and	}
{	      _LDescPtr fields of an _Item record, as you will likely	}
{	      corrupt the memory containing your menu structures.  Use	}
{	      __ItemMnu and/or __LItemMnu to update these fields.	}
{									}
{	      On error _MenuError may be set to:  _InvalidMenu		}
{						  _InvalidItem		}
{									}
{ Version     4.00 (C)Copyright Blaise Computing Inc. 1987		}
{_______________________________________________________________________}

function __RetItMnu(MenuPtr : _MenuPtr; Col,Row : byte) :_ItemPtr;

  var
    TempPtr : _ItemPtr;
    ColRow  : word;

  begin {__RetItMnu}

    __RetItMnu := NIL;

    if (not ValidSig(MenuPtr,MENUSIG_)) then
       Exit;			       { Not a valid menu pointer	}

    { Find a match in the list of menu items.  When a match if found,	}
    { the function value is set and the function exited.		}

    Hi(ColRow) := Col;
    Lo(ColRow) := Row;
    TempPtr := MenuPtr^._MItemsPtr;
    while (TempPtr <> NIL) do
      if (not ValidSig(TempPtr,ITEMSIG_)) then
	 Exit
      else
	 if (TempPtr^._ColRow = ColRow) then
	    begin
	      __RetItMnu := TempPtr;
	      Exit
	    end
	 else
	    TempPtr := TempPtr^._NextItem;

    SetMenuError(_InvalidItem)	       { No matching item found 	}

  end;	{__RetItMnu}
