proc Mainmu()
   while true
      for x from 1 to 10                    ; top level menu initialization
         Muchoice[X] = ""                   ; 'empty' Choice array
      endfor
      Menuline = ""                         ; initialize Menuline to null
      Muchoice[1] = " Main "                ; set first array element to 'Main'
      Menulev = 1                           ; set to 1st menu level
      Mainmenuprompt()                      ; display canvas prompt & Menuline
      cursor off
      showmenu
         "Sales"       : "Order, quote and sales activity",
         "Inventory"   : "Inventory record creation, editing and reporting",
         "Customers"   : "Customer record creation, editing and reporting",
         "Menu_map"    : "Display menu map"
      to Choice
      if Choice = "Esc" then
         loop
      endif
      Lastmensel = Choice
      switch
         case Choice = "Sales":
            Menuline("D")                   ; parameter indicates 'Down'
            Salmu()                         ; call to next menu level
            Menuline("U")                   ; parameter indicates 'Up'
            loop
            .

proc Menuline(Du)                           ; indicates direction Down or Up
   private X
   switch
      case Du = "D":                        ; adding current Choice onto Menuline
         Menulev = Menulev + 1
         Muchoice[Menulev] = "/ " + Choice + " "
         Menuline = ""
         for X from 1 to Menulev
            Menuline = Menuline + Muchoice[X]
         endfor
      case Du = "U":                        ; taking last Choice from Menuline
         Menulev = Menulev - 1              ; reduce Menu level by one
         Menuline = ""                      ; set Menuline to null
         for X from 1 to Menulev            ; build new Menuline
            Menuline = Menuline + Muchoice[X]
         endfor
   endswitch
endproc

proc Menulinewrite()                        ; display Menuline and box
   private L,                               ; called from Menuprompt()


           
