#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

load ../src/gnocl.so

set box [gnocl::box -orientation vertical]
set sc1 [gnocl::scale -digits 0 -variable var1 \
      -command {printVals %w %v ::var1}]
$box add $sc1

proc printVals { win val var } {
   puts -nonewline "\""
   puts -nonewline [$win getValue]
   puts -nonewline "\" = \""
   puts -nonewline $val
   puts -nonewline "\" = \""
   puts -nonewline [set $var]
   puts "\""
}

if { $argc == 1 } {
   set win [gnocl::plug [lindex $argv 0] -child $box]
} else {
   set win [gnocl::window -child $box -width 200 -height 200]
}

gnocl::mainLoop

