{***********************************************************************}
{									}
{ __LItemMnu  Define a Lotus-stype menu item				}
{									}
{ function  __LItemMnu( 	 MenuPtr : _MenuPtr;			}
{				 Col,Row,				}
{		       LDescCol,LDescRow,				}
{				  HiChPos,				}
{				HiChFore,				}
{				HiChBack : byte;			}
{				 Protect : boolean;			}
{				MenuItem : _MenuString; 		}
{				  LDescr : string) : _ItemPtr;		}
{									}
{	      MenuPtr	Pointer to the menu descriptor returned by	}
{			__MakeMnu when the menu was constructed.	}
{	      Col,Row	Item position within the window 		}
{	      LDescCol, 						}
{	      LDescRow	Position of Lotus-style description		}
{	      HiChPos	Position of the highlighted character in	}
{			the string MenuItem				}
{	      HiChFore, 						}
{	      HiChBack	Attribute of the highlighted character		}
{	      Protect	TRUE if the item can not be selected, FALSE	}
{			if it can be selected.				}
{	      MenuItem	The text of the item				}
{	      LDescr	The text of the help line.			}
{									}
{ Description This function adds or replaces a Lotus-style _Item	}
{	      in a Lotus-style menu, then returns a pointer to the	}
{	      _Item, of NIL if there is an error.			}
{									}
{	      Every menu has a doubly-linked list of _Item records	}
{	      associated with by the pointer _MItemsPtr, which points	}
{	      to the first item in the list.  The list is created and	}
{	      updated with calls to this function or to __ItemMnu (or	}
{	      with a single call to __BuildMnu).			}
{									}
{	      A menu item is uniquely defined by its column and 	}
{	      row (_Col,_Row) coordinates.  When __LItemMnu finds	}
{	      an item with a matching column and row, it replaces	}
{	      the existing item, otherwise it adds a new item to the	}
{	      list.							}
{									}
{	      __LItemMnu is a functional superset of _ItemMnu in	}
{	      that it defines an additional field (the 'Lotus' des-	}
{	      cription or help line) that appears whenever the high-	}
{	      light bar moves to the corresponding item, in the style	}
{	      of Lotus 1-2-3.						}
{									}
{	      On error _MenuError may be set to:  _InvalidWindow	}
{						  _InvalidMenu		}
{						  _InvalidItem		}
{									}
{ Version     4.00 (C)Copyright Blaise Computing Inc. 1987		}
{_______________________________________________________________________}

function __LItemMnu(	      MenuPtr : _MenuPtr;
			      Col,Row,
		    LDescCol,LDescRow,
			      HiChPos,
			     HiChFore,
			     HiChBack : byte;
			      Protect : boolean;
			     MenuItem : _MenuString;
			       LDescr : string) : _ItemPtr;

  var
    TempPtr  : _ItemPtr;

  begin {__LItemMnu}

    __LItemMnu := NIL;

    { First call __ItemMnu to add/replace the standard item data:	}

    TempPtr := __ItemMnu(MenuPtr,Col,Row,HiChPos,HiChFore,HiChBack,
						       Protect,MenuItem);
    if (TempPtr = NIL) then
	Exit;

    with TempPtr^ do
      begin
	if (_LDescPtr <> NIL)  then		{ Update, so release	}
	   FreeMem(_LDescPtr,_LDescLen + 1);	{ memory for previous	}
	_LDescCol := LDescCol;			{ text string.		}
	_LDescRow := LDescRow;
	_LDescLen := length(LDescr);
	GetMem(_LDescPtr,_LDescLen + 1);	{ Allocate description	}
	string(_LDescPtr^) := LDescr		{ Assign new string	}
      end;

    __LItemMnu := TempPtr

  end;	{__LItemMnu}
