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

load ../src/gnocl.so

set mainBox [gnocl::box -orientation vertical]
$mainBox add [gnocl::spinButton]
set s1 [gnocl::spinButton -lower 100 -value 150 -upper 200 \
      -stepInc 2 -pageInc 30 -digits 0 -variable varS1 \
      -command {printVals %w %v ::varS1}]
$mainBox add $s1
$mainBox add [gnocl::spinButton -lower -10 -value 10 -upper 100 \
      -stepInc 2 -pageInc 10 -numeric 1 -digits 2 \
      -variable varS2 -command {printVals %w %v ::varS2}]

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 $mainBox]
} else {
   set win [gnocl::window -child $mainBox]
}

gnocl::mainLoop


