From: sls Date: Wed, 21 Jun 1995 09:22:07 +0000 (+0000) Subject: Add Show Image menu item and functionality. X-Git-Tag: r_5_1_4~36 X-Git-Url: https://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=8c9dba18bd06c8e7bf6131ac0d27b6c46a925046;p=tkinspect Add Show Image menu item and functionality. --- diff --git a/images_list.tcl b/images_list.tcl index 1cc0e3b..95e2abd 100644 --- a/images_list.tcl +++ b/images_list.tcl @@ -7,6 +7,12 @@ widget images_list { object_include tkinspect_list param title "Images" + method create {} { + tkinspect_list:create $self + $slot(menu) add separator + $slot(menu) add command -label "Show Image" -underline 5 \ + -command "$self show_image" + } method get_item_name {} { return image } method update {target} { $self clear @@ -28,4 +34,26 @@ widget images_list { method send_filter {value} { return $value } + method show_image {} { + set target [$slot(main) target] + if ![string length $slot(current_item)] { + tkinspect_failure \ + "No image has been selected. Please select one first." + } + if ![send $target info exists __tkinspect_image_counter__] { + send $target set __tkinspect_image_counter__ 0 + } + while {[send $target winfo exists .tkinspect_image\$__tkinspect_image_counter__]} { + send $target incr __tkinspect_image_counter__ + } + set w .tkinspect_image[send $target set __tkinspect_image_counter__] + send $target [subst { + toplevel $w + button $w.close -text "Close $slot(current_item)" \ + -command "destroy $w" + label $w.img -image $slot(current_item) + pack $w.close $w.img -side top + wm title $w "tkinspect $slot(current_item)" + }] + } }