1 # vim: ft=tcl ts=4 shiftwidth=4 foldmethod=marker foldmarker=<<<,>>>
3 proc tlc::application {pathName args} {
4 uplevel tlc::Application $pathName $args
8 class tlc::Application {
9 inherit tlc::Module tlc::Baselog
13 if {$armed && $::errorInfo != ""} {
14 log error "\nerror constructing Application: $errmsg\n$::errorInfo"
21 variable confirm_close unsaved
26 variable unsaved_info ""
28 method confirm_close {}
33 body tlc::Application::constructor {args} { #<<<1
34 eval itk_initialize $args
36 namespace eval $this {}
38 tlc::Gate ${this}::unsaved_info unsaved_info -mode "or"
40 configure -onclose [code $this confirm_close]
42 namespace import ::blt::*
46 tlc::Confirm .confirm -title "Confirm Action"
47 tlc::Deny .deny -title "Permission Denied"
48 tlc::Getinf .getinf -title "Question"
49 tlc::Infowin .nfo -title "Information"
55 body tlc::Application::confirm_close {} { #<<<1
56 if {$confirm_close == "unsaved"} {
58 ![${this}::unsaved_info state]
59 || [.confirm ask "You have unsaved information!\nAre you sure you want to exit?" Yes No] == "Yes"
63 } elseif {$confirm_close} {
64 if {[.confirm ask "Are you sure you want to exit?" Yes No] == "Yes"} {