diff options
author | dkf <dkf@noemail.net> | 2007-10-31 16:11:49 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2007-10-31 16:11:49 (GMT) |
commit | 2b2d4c1fba19e12c62ca54af3396da9dcc83e8f1 (patch) | |
tree | f9264e342aa7b25da4989cb63802edda038d8eac /library/demos/image2.tcl | |
parent | 4b54318b4c8a95f6461136e1e1c4b1cca4cf031f (diff) | |
download | tk-2b2d4c1fba19e12c62ca54af3396da9dcc83e8f1.zip tk-2b2d4c1fba19e12c62ca54af3396da9dcc83e8f1.tar.gz tk-2b2d4c1fba19e12c62ca54af3396da9dcc83e8f1.tar.bz2 |
Mark non-loadable images as such instead of throwing a nasty dialog,
following suggestion from Don Porter.
FossilOrigin-Name: a083ed0f7251dd1585578cf4430aa6b07c4dd2f2
Diffstat (limited to 'library/demos/image2.tcl')
-rw-r--r-- | library/demos/image2.tcl | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/library/demos/image2.tcl b/library/demos/image2.tcl index 916551e..0aed1f5 100644 --- a/library/demos/image2.tcl +++ b/library/demos/image2.tcl @@ -3,7 +3,7 @@ # This demonstration script creates a simple collection of widgets # that allow you to select and view images in a Tk label. # -# RCS: @(#) $Id: image2.tcl,v 1.9 2004/12/21 11:56:35 dkf Exp $ +# RCS: @(#) $Id: image2.tcl,v 1.10 2007/10/31 16:11:49 dkf Exp $ if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." @@ -22,7 +22,7 @@ proc loadDir w { global dirName $w.f.list delete 0 end - foreach i [lsort [glob -directory $dirName *]] { + foreach i [lsort [glob -type f -directory $dirName *]] { $w.f.list insert end [file tail $i] } } @@ -57,7 +57,12 @@ proc loadImage {w x y} { global dirName set file [file join $dirName [$w.f.list get @$x,$y]] - image2a configure -file $file + if {[catch { + image2a configure -file $file + }]} then { + # Mark the file as not loadable + $w.f.list itemconfigure @$x,$y -bg \#c00000 -selectbackground \#ff0000 + } } set w .image2 |