
# The variable winNum is used to provide a unique name
# for each window.
set winNum 0

# Loop on days that we know exist in this log file.
# Real code might do a pre-scan to find out what days are actually present.

foreach day {20 21 22 23 24 25 26 27} {
  # Column must be initialized inside this loop
  set column 1
  
  # Create a label for the day and grid it
  # Note that the $day variable is used for the row
  # The grid command ignores empty rows and columns, so this leaves
  #   no blank spaces.
  label .day_$winNum -text $day
  grid .day_$winNum -row $day -column $column
  
  # create a new winNum for the next window
  set winNum [expr $winNum + 1]
  
  # Loop for the messages we know are in this file
  foreach type { dhcpd: last named ntpd sshd syslogd } {
    set column [expr {$column + 1}]
  
    # A new label : note the -borderwidth and -relief options
    # these make the labels obviously separate
    label .type_$winNum -text "$type for $day" -borderwidth 2 -relief ridge
    grid .type_$winNum -row $day -column $column
    
    # Create new winNum and Step to next column
    set winNum [expr $winNum + 1]
  }
}  

