# initialize a variable that can be used inside a 'command'
#set out ""

proc output_light { output } {


    #----------------------------------------------------
    # Note : Do Not change the ordering of global and set below,
    #	   otherwise it will give an error tht says that the variable
    #          has already exist
    #----------------------------------------------------

    # Declare the variable first
    global out

    set out $output


    if [winfo exists .output_light] {
   	destroy .output_light
    }

    # Create a window to display the output lists
    toplevel .output_light -width 10c -height 5c
    set out_light .output_light

    # The "Output Light" title
    label $out_light.title -text "Output Light"  -relief groove -fg blue
    pack $out_light.title -side top  -fill x -padx 3 -pady 3


##########################################################################################################

    # Create frames to group outputs in certain ways
    frame $out_light.digest1
    frame $out_light.digest2
    frame $out_light.digest3
    frame $out_light.digest4
    frame $out_light.digmpl
    frame $out_light.digmpl2

    # Pack all the frames up
    pack  $out_light.digest1 $out_light.digest2 $out_light.digest3 $out_light.digest4 $out_light.digmpl $out_light.digmpl2 -side left



    #----------------------------------------------------------------------------------------
    # Digital MPL
    #----------------------------------------------------------------------------------------

    button $out_light.digmpl.dig_mpl1 -relief flat -text "Digital MPL #1" -command { light_list_output $out  "Digital MPL 1"}
    button $out_light.digmpl.dig_mpl2 -relief flat -text "Digital MPL #2" -command { light_list_output $out  "Digital MPL 2"}
    button $out_light.digmpl.dig_mpl3 -relief flat -text "Digital MPL #3" -command { light_list_output $out  "Digital MPL 3"}
    button $out_light.digmpl.dig_mpl4 -relief flat -text "Digital MPL #4" -command { light_list_output $out  "Digital MPL 4"}
    button $out_light.digmpl.dig_mpl5 -relief flat -text "Digital MPL #5" -command { light_list_output $out  "Digital MPL 5"}
    button $out_light.digmpl.dig_mpl6 -relief flat -text "Digital MPL #6" -command { light_list_output $out  "Digital MPL 6"}
    button $out_light.digmpl.dig_mpl7 -relief flat -text "Digital MPL #7" -command { light_list_output $out  "Digital MPL 7"}
    button $out_light.digmpl.dig_mpl8 -relief flat -text "Digital MPL #8" -command { light_list_output $out  "Digital MPL 8"}
    button $out_light.digmpl.dig_mpl9 -relief flat -text "Digital MPL #9" -command { light_list_output $out  "Digital MPL 9"}
    button $out_light.digmpl.dig_mpl10 -relief flat -text "Digital MPL #10" -command { light_list_output $out  "Digital MPL 10"}
    button $out_light.digmpl.dig_mpl11 -relief flat -text "Digital MPL #11" -command { light_list_output $out  "Digital MPL 11"}
    button $out_light.digmpl.dig_mpl12 -relief flat -text "Digital MPL #12" -command { light_list_output $out  "Digital MPL 12"}
    button $out_light.digmpl.dig_mpl13 -relief flat -text "Digital MPL #13" -command { light_list_output $out  "Digital MPL 13"}
    button $out_light.digmpl.dig_mpl14 -relief flat -text "Digital MPL #14" -command { light_list_output $out  "Digital MPL 14"}
    button $out_light.digmpl.dig_mpl15 -relief flat -text "Digital MPL #15" -command { light_list_output $out  "Digital MPL 15"}
    button $out_light.digmpl.dig_mpl16 -relief flat -text "Digital MPL #16" -command { light_list_output $out  "Digital MPL 16"}


    button $out_light.digmpl2.dig_mpl17 -relief flat -text "Digital MPL #17" -command { light_list_output $out  "Digital MPL 17"}
    button $out_light.digmpl2.dig_mpl18 -relief flat -text "Digital MPL #18" -command { light_list_output $out  "Digital MPL 18"}
    button $out_light.digmpl2.dig_mpl19 -relief flat -text "Digital MPL #19" -command { light_list_output $out  "Digital MPL 19"}
    button $out_light.digmpl2.dig_mpl20 -relief flat -text "Digital MPL #20" -command { light_list_output $out  "Digital MPL 20"}
    button $out_light.digmpl2.dig_mpl21 -relief flat -text "Digital MPL #21" -command { light_list_output $out  "Digital MPL 21"}
    button $out_light.digmpl2.dig_mpl22 -relief flat -text "Digital MPL #22" -command { light_list_output $out  "Digital MPL 22"}
    button $out_light.digmpl2.dig_mpl23 -relief flat -text "Digital MPL #23" -command { light_list_output $out  "Digital MPL 23"}
    button $out_light.digmpl2.dig_mpl24 -relief flat -text "Digital MPL #24" -command { light_list_output $out  "Digital MPL 24"}
    button $out_light.digmpl2.dig_mpl25 -relief flat -text "Digital MPL #25" -command { light_list_output $out  "Digital MPL 25"}
    button $out_light.digmpl2.dig_mpl26 -relief flat -text "Digital MPL #26" -command { light_list_output $out  "Digital MPL 26"}
    button $out_light.digmpl2.dig_mpl27 -relief flat -text "Digital MPL #27" -command { light_list_output $out  "Digital MPL 27"}
    button $out_light.digmpl2.dig_mpl28 -relief flat -text "Digital MPL #28" -command { light_list_output $out  "Digital MPL 28"}
    button $out_light.digmpl2.dig_mpl29 -relief flat -text "Digital MPL #29" -command { light_list_output $out  "Digital MPL 29"}
    button $out_light.digmpl2.dig_mpl30 -relief flat -text "Digital MPL #30" -command { light_list_output $out  "Digital MPL 30"}
    button $out_light.digmpl2.dig_mpl31 -relief flat -text "Digital MPL #31" -command { light_list_output $out  "Digital MPL 31"}
    button $out_light.digmpl2.dig_mpl32 -relief flat -text "Digital MPL #32" -command { light_list_output $out  "Digital MPL 32"}

   #----------------------------------------------------------------------------------------



    #----------------------------------------------------------------------------------------
    # Digital GESOUT
    #----------------------------------------------------------------------------------------

    button $out_light.digest1.dig_gesout1 -relief flat -text "Digital Gesout #1" -command { light_list_output $out "Digital Gesout 1" }
    button $out_light.digest1.dig_gesout2 -relief flat -text "Digital Gesout #2" -command { light_list_output $out "Digital Gesout 2" }
    button $out_light.digest1.dig_gesout3 -relief flat -text "Digital Gesout #3" -command { light_list_output $out "Digital Gesout 3" }
    button $out_light.digest1.dig_gesout4 -relief flat -text "Digital Gesout #4" -command { light_list_output $out "Digital Gesout 4" }
    button $out_light.digest1.dig_gesout5 -relief flat -text "Digital Gesout #5" -command { light_list_output $out "Digital Gesout 5" }
    button $out_light.digest1.dig_gesout6 -relief flat -text "Digital Gesout #6" -command { light_list_output $out "Digital Gesout 6" }
    button $out_light.digest1.dig_gesout7 -relief flat -text "Digital Gesout #7" -command { light_list_output $out "Digital Gesout 7" }
    button $out_light.digest1.dig_gesout8 -relief flat -text "Digital Gesout #8" -command { light_list_output $out "Digital Gesout 8" }
    button $out_light.digest1.dig_gesout9 -relief flat -text "Digital Gesout #9" -command { light_list_output $out "Digital Gesout 9" }
    button $out_light.digest1.dig_gesout10 -relief flat -text "Digital Gesout #10" -command { light_list_output $out "Digital Gesout 10" }
    button $out_light.digest1.dig_gesout11 -relief flat -text "Digital Gesout #11" -command { light_list_output $out "Digital Gesout 11" }
    button $out_light.digest1.dig_gesout12 -relief flat -text "Digital Gesout #12" -command { light_list_output $out "Digital Gesout 12" }
    button $out_light.digest1.dig_gesout13 -relief flat -text "Digital Gesout #13" -command { light_list_output $out "Digital Gesout 13" }
    button $out_light.digest1.dig_gesout14 -relief flat -text "Digital Gesout #14" -command { light_list_output $out "Digital Gesout 14" }
    button $out_light.digest1.dig_gesout15 -relief flat -text "Digital Gesout #15" -command { light_list_output $out "Digital Gesout 15" }
    button $out_light.digest1.dig_gesout16 -relief flat -text "Digital Gesout #16" -command { light_list_output $out "Digital Gesout 16" }

    button $out_light.digest2.dig_gesout17 -relief flat -text "Digital Gesout #17" -command { light_list_output $out "Digital Gesout 17" }
    button $out_light.digest2.dig_gesout18 -relief flat -text "Digital Gesout #18" -command { light_list_output $out "Digital Gesout 18" }
    button $out_light.digest2.dig_gesout19 -relief flat -text "Digital Gesout #19" -command { light_list_output $out "Digital Gesout 19" }
    button $out_light.digest2.dig_gesout20 -relief flat -text "Digital Gesout #20" -command { light_list_output $out "Digital Gesout 20" }
    button $out_light.digest2.dig_gesout21 -relief flat -text "Digital Gesout #21" -command { light_list_output $out "Digital Gesout 21" }
    button $out_light.digest2.dig_gesout22 -relief flat -text "Digital Gesout #22" -command { light_list_output $out "Digital Gesout 22" }
    button $out_light.digest2.dig_gesout23 -relief flat -text "Digital Gesout #23" -command { light_list_output $out "Digital Gesout 23" }
    button $out_light.digest2.dig_gesout24 -relief flat -text "Digital Gesout #24" -command { light_list_output $out "Digital Gesout 24" }
    button $out_light.digest2.dig_gesout25 -relief flat -text "Digital Gesout #25" -command { light_list_output $out "Digital Gesout 25" }
    button $out_light.digest2.dig_gesout26 -relief flat -text "Digital Gesout #26" -command { light_list_output $out "Digital Gesout 26" }
    button $out_light.digest2.dig_gesout27 -relief flat -text "Digital Gesout #27" -command { light_list_output $out "Digital Gesout 27" }
    button $out_light.digest2.dig_gesout28 -relief flat -text "Digital Gesout #28" -command { light_list_output $out "Digital Gesout 28" }
    button $out_light.digest2.dig_gesout29 -relief flat -text "Digital Gesout #29" -command { light_list_output $out "Digital Gesout 29" }
    button $out_light.digest2.dig_gesout30 -relief flat -text "Digital Gesout #30" -command { light_list_output $out "Digital Gesout 30" }
    button $out_light.digest2.dig_gesout31 -relief flat -text "Digital Gesout #31" -command { light_list_output $out "Digital Gesout 31" }
    button $out_light.digest2.dig_gesout32 -relief flat -text "Digital Gesout #32" -command { light_list_output $out "Digital Gesout 32" }

    button $out_light.digest3.dig_gesout33 -relief flat -text "Digital Gesout #33" -command { light_list_output $out "Digital Gesout 33" }
    button $out_light.digest3.dig_gesout34 -relief flat -text "Digital Gesout #34" -command { light_list_output $out "Digital Gesout 34" }
    button $out_light.digest3.dig_gesout35 -relief flat -text "Digital Gesout #35" -command { light_list_output $out "Digital Gesout 35" }
    button $out_light.digest3.dig_gesout36 -relief flat -text "Digital Gesout #36" -command { light_list_output $out "Digital Gesout 36" }
    button $out_light.digest3.dig_gesout37 -relief flat -text "Digital Gesout #37" -command { light_list_output $out "Digital Gesout 37" }
    button $out_light.digest3.dig_gesout38 -relief flat -text "Digital Gesout #38" -command { light_list_output $out "Digital Gesout 38" }
    button $out_light.digest3.dig_gesout39 -relief flat -text "Digital Gesout #39" -command { light_list_output $out "Digital Gesout 39" }
    button $out_light.digest3.dig_gesout40 -relief flat -text "Digital Gesout #40" -command { light_list_output $out "Digital Gesout 40" }
    button $out_light.digest3.dig_gesout41 -relief flat -text "Digital Gesout #41" -command { light_list_output $out "Digital Gesout 41" }
    button $out_light.digest3.dig_gesout42 -relief flat -text "Digital Gesout #42" -command { light_list_output $out "Digital Gesout 42" }
    button $out_light.digest3.dig_gesout43 -relief flat -text "Digital Gesout #43" -command { light_list_output $out "Digital Gesout 43" }
    button $out_light.digest3.dig_gesout44 -relief flat -text "Digital Gesout #44" -command { light_list_output $out "Digital Gesout 44" }
    button $out_light.digest3.dig_gesout45 -relief flat -text "Digital Gesout #45" -command { light_list_output $out "Digital Gesout 45" }
    button $out_light.digest3.dig_gesout46 -relief flat -text "Digital Gesout #46" -command { light_list_output $out "Digital Gesout 46" }
    button $out_light.digest3.dig_gesout47 -relief flat -text "Digital Gesout #47" -command { light_list_output $out "Digital Gesout 47" }
    button $out_light.digest3.dig_gesout48 -relief flat -text "Digital Gesout #48" -command { light_list_output $out "Digital Gesout 48" }

    button $out_light.digest4.dig_gesout49 -relief flat -text "Digital Gesout #49" -command { light_list_output $out "Digital Gesout 49" }
    button $out_light.digest4.dig_gesout50 -relief flat -text "Digital Gesout #50" -command { light_list_output $out "Digital Gesout 50" }
    button $out_light.digest4.dig_gesout51 -relief flat -text "Digital Gesout #51" -command { light_list_output $out "Digital Gesout 51" }
    button $out_light.digest4.dig_gesout52 -relief flat -text "Digital Gesout #52" -command { light_list_output $out "Digital Gesout 52" }
    button $out_light.digest4.dig_gesout53 -relief flat -text "Digital Gesout #53" -command { light_list_output $out "Digital Gesout 53" }
    button $out_light.digest4.dig_gesout54 -relief flat -text "Digital Gesout #54" -command { light_list_output $out "Digital Gesout 54" }
    button $out_light.digest4.dig_gesout55 -relief flat -text "Digital Gesout #55" -command { light_list_output $out "Digital Gesout 55" }
    button $out_light.digest4.dig_gesout56 -relief flat -text "Digital Gesout #56" -command { light_list_output $out "Digital Gesout 56" }
    button $out_light.digest4.dig_gesout57 -relief flat -text "Digital Gesout #57" -command { light_list_output $out "Digital Gesout 57" }
    button $out_light.digest4.dig_gesout58 -relief flat -text "Digital Gesout #58" -command { light_list_output $out "Digital Gesout 58" }
    button $out_light.digest4.dig_gesout59 -relief flat -text "Digital Gesout #59" -command { light_list_output $out "Digital Gesout 59" }
    button $out_light.digest4.dig_gesout60 -relief flat -text "Digital Gesout #60" -command { light_list_output $out "Digital Gesout 60" }
    button $out_light.digest4.dig_gesout61 -relief flat -text "Digital Gesout #61" -command { light_list_output $out "Digital Gesout 61" }
    button $out_light.digest4.dig_gesout62 -relief flat -text "Digital Gesout #62" -command { light_list_output $out "Digital Gesout 62" }
    button $out_light.digest4.dig_gesout63 -relief flat -text "Digital Gesout #63" -command { light_list_output $out "Digital Gesout 63" }
    button $out_light.digest4.dig_gesout64 -relief flat -text "Digital Gesout #64" -command { light_list_output $out "Digital Gesout 64" }



   #----------------------------------------------------------------------------------------

   #---------------------#
   # Pack everything up  #
   #---------------------#

      for {set i 1}  {$i <= 16} {incr i} {
         pack  $out_light.digmpl.dig_mpl$i -side top
         pack  $out_light.digest1.dig_gesout$i -side top
      }

      for {set i 17} {$i <= 32} {incr i} {
      	 pack  $out_light.digmpl2.dig_mpl$i -side top
         pack  $out_light.digest2.dig_gesout$i -side top

       }

      for {set i 33} {$i <= 48} {incr i} {
         pack  $out_light.digest3.dig_gesout$i -side top

       	}
   	
   	for {set i 49} {$i <= 64} {incr i} {
         pack  $out_light.digest4.dig_gesout$i -side top

       }




   # add a Close button
   button $out_light.close -text Close -command {destroy .output_light}
   pack $out_light.close -side bottom -pady 3m


   #--------------------------------------------------
   # This procedure will display the selection we made in the entry slot
   # in "light_menu.tcl"
   #--------------------------------------------------

   proc light_list_output { output out_text } {

      .light_menu.$output delete 0 100
      .light_menu.$output insert 0 $out_text

      # Close the output list after
      destroy .output_light

   # end proc light_list_output
   }


# end  of procedure output_light   	
}





