# interface generated by SpecTcl version 1.1 from C:/EasySDE/Testing/resLog.ui
#   root     is the parent window for this user interface

proc resLog_ui {root args} {

	# this treats "." as a special case

	if {$root == "."} {
	    set base ""
	} else {
	    set base $root
	}
    
	text $base.logText \
		-height 25 \
		-width 73 \
		-yscrollcommand "$base.scrollbar#1 set"

	scrollbar $base.scrollbar#1 \
		-command "$base.logText yview"

	button $base.saveButton \
		-command "save \"$base\"" \
		-text Save

	button $base.exitButton \
		-command "finish \"$base\"" \
		-text Exit


	# Geometry management

	grid $base.logText -in $root	-row 1 -column 1  \
		-columnspan 3 \
		-sticky nesw
	grid $base.scrollbar#1 -in $root	-row 1 -column 4  \
		-sticky ns
	grid $base.saveButton -in $root	-row 2 -column 2 
	grid $base.exitButton -in $root	-row 2 -column 3 

	# Resize behavior management

	grid rowconfigure $root 1 -weight 1 -minsize 30
	grid rowconfigure $root 2 -weight 0 -minsize 30
	grid columnconfigure $root 1 -weight 1 -minsize 30
	grid columnconfigure $root 2 -weight 0 -minsize 30
	grid columnconfigure $root 3 -weight 0 -minsize 30
	grid columnconfigure $root 4 -weight 0 -minsize 30
# additional interface code
global Saved
set Saved 0

proc finish {base} {
	global Saved
	if {$Saved} exit
	set q [tk_messageBox -message {Save?} -type yesno -icon question]
	if {[string compare $q no]} {
		save "$base"
	}
	exit
}

proc save {base} {
	global Saved
	set File [tk_getSaveFile -title "Saving"]
	if {$File == {}} return
	if {[catch {set File [open $File w]} Err]} {
		 tk_messageBox -title Exit -type ok -message $Err -icon error
	} else {
		puts $File [$base.logText get 0.0 end]
		flush $File
		close $File
		set Saved 1
	}
}

$base.logText insert 0.0 [lindex $args 0]
$base.logText configure -state disabled
















# end additional interface code

}


# Allow interface to be run "stand-alone" for testing

catch {
    if [info exists embed_args] {
	# we are running in the plugin
	resLog_ui .
    } else {
	# we are running in stand-alone mode
	if {$argv0 == [info script]} {
	    wm title . "Testing resLog_ui"
	    resLog_ui .
	}
    }
}
