  # ==========================
  #
  # mass demo
  #
  # ==========================

  # -----------
  # parameters
  # -----------
  set count 1000000
  set hugelist 1  ;# 0 for listbox
  set widget [expr {$hugelist ? "hugelist" : "listbox"}]
  # -----------
  # get package
  # -----------
  package require Tk 8.4
  if {$hugelist} \
  {
    lappend auto_path [file join [pwd] ..]
    package require Hugelist 1.3
    namespace import ::hugelist::hugelist
  }
  # -----------
  # set current dir
  # -----------
  cd [file dirname [info script]]
  # -----------
  # create items
  # -----------
  wm withdraw .
  toplevel .wait -bg gold -bd 2 -relief sunken
  wm overrideredirect .wait 1
  label .wait.l -text "building items..." -bg gold
  pack .wait.l -expand 1 -fill both -pady 40
  bind .wait <Visibility> { raise .wait; wm geometry .wait [wm geometry .] }
  update
  for {set i 1} {$i <= $count} {incr i} { lappend ::listvar item-$i }
  wm deiconify .
  # -----------
  # create widget 
  # -----------
  .wait.l config -text "building $widget..."; update
  frame .f1
  wm title . "mass demo"
    # shared syntax
  $widget .f1.hl -listvariable ::listvar -selectmode extended \
                 -bg beige \
                 -xscrollcommand [list .f1.hs set] \
                 -yscrollcommand [list .f1.vs set]
  scrollbar .f1.vs -command [list .f1.hl yview]
  scrollbar .f1.hs -command [list .f1.hl xview] -orient horizontal
  pack .f1 -expand 1 -fill both
  grid .f1.hl -row 0 -column 0 -sticky nsew 
  grid .f1.vs -row 0 -column 1 -sticky nse
  grid .f1.hs -row 1 -column 0 -sticky ews
  grid columnconfigure .f1 0 -weight 1
  grid rowconfigure .f1 0 -weight 1
  focus -force .f1.hl
    # hugelist extensions
  if {$hugelist} \
  {
    image create photo img1 -file bottom.gif
    image create photo img2 -file left.gif
    .f1.hl config -alternate azure
    .f1.hl itemconfig 0 end -fg sienna -image img1 -font {Arial 8}
    .f1.hl itemconfig 3     -fg red -font {Courier 9} -left 10 -image img2 -text #3
    .f1.hl itemconfig end-3 -fg red -font {Courier 9} -left 10 -image img2 -text #end-3
    .f1.hl itemconfig end   -font {Arial 8 bold}
  }
  
  destroy .wait
