VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "clsMenu1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
' Retail example #3
' ActiveX: Guide to the Perplexed
' Copyright (c) 1997 by Desaware Inc.

Option Explicit

' A type describing the item
Private Type MenuItem
   ItemName As String
   ItemPrice As Currency
End Type

Private MenuList() As MenuItem   ' Array of menu items
Private NextItem As Integer      ' Next item to load

' Method to add menu items to the clsMenu object
Public Sub AddMenuItem(ByVal ItemName$, ByVal ItemPrice As Currency)
   Dim currenttop%
   ReDim Preserve MenuList(NextItem)
   MenuList(NextItem).ItemPrice = ItemPrice
   MenuList(NextItem).ItemName = ItemName
   NextItem = NextItem + 1
End Sub


' Retrieve the number of items in this menu
Public Function ItemCount() As Integer
   ItemCount = NextItem
End Function

' Expose the price and name as functions

Public Function ItemPrice(ByVal itemnum As Integer)
   ' We can do error checking
   If itemnum >= NextItem Then Exit Function
   ItemPrice = MenuList(itemnum).ItemPrice
End Function

Public Function ItemName(ByVal itemnum As Integer)
   ' We can do error checking
   If itemnum >= NextItem Then Exit Function
   ItemName = MenuList(itemnum).ItemName
End Function

