# $Header: /home/cvsroot/tcldb/wisql/Tlib/getUserInput,v 1.1.1.1 1996/10/12 02:26:27 de Exp $
# tcl procs saved on Tue Sep 05 09:32:59 PDT 1995

proc getUserInput {title var help start} {

  	set win_title $title
#  	regsub -all {_} $win_title " " win_title

upvar #0 $var gvar

	set w .getuserinput
	catch {destroy $w}
	toplevel $w -class Dialog
	wm title $w $title 
	wm geom $w "400x300+200+200"

    # Create the message widget and arrange for it to be centered in the
    # top frame.

    set font [getFont $w smallertim]
    message $w.prompt -justify center  -font "$font" -text "$help" -aspect 600

#	create the user input area
    set font [getFont $w mediumhel]
    text $w.input -font $font -relief sunken -height 5 -width 40 -border 1
    if {$gvar == ""} {
    $w.input insert 1.0 "$start "
    } else {
    $w.input insert 1.0 "$gvar "
    }

    bind $w.input <Shift-Return> "$w.control.ok invoke"

#	control frame

    frame $w.control -relief raised -border 1

    button $w.control.ok -text OK -relief raised -border 2  -command "set $var \[$w.input get 1.0 end\]; destroy $w" -padx 0 -pady 0
    button $w.control.clr -text Clear -relief raised -border 1  -command "set $var {}; destroy $w" -padx 0 -pady 0
    button $w.control.can -text Cancel -relief raised -border 1  -command "destroy $w" -padx 0 -pady 0
    
    pack $w.control.clr -side left -expand true -fill x
    pack $w.control.can  -side left -expand true -fill x
    pack $w.control.ok -side left -expand true -fill x


    pack $w.prompt -side top -fill both -expand true
    pack $w.input -side top -fill both -expand true
    pack $w.control -side top -fill both -expand true

}

