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]
43 namespace import ::blt::*
47 tlc::Confirm .confirm -title "Confirm Action"
48 tlc::Deny .deny -title "Permission Denied"
49 tlc::Getinf .getinf -title "Question"
50 tlc::Infowin .nfo -title "Information"
56 body tlc::Application::confirm_close {} { #<<<1
57 if {$confirm_close == "unsaved"} {
59 ![${this}::unsaved_info state]
60 || [.confirm ask "You have unsaved information!\nAre you sure you want to exit?" Yes No] == "Yes"
64 } elseif {$confirm_close} {
65 if {[.confirm ask "Are you sure you want to exit?" Yes No] == "Yes"} {