diff options
Diffstat (limited to 'itcl/itk/library/itk.tcl')
-rw-r--r-- | itcl/itk/library/itk.tcl | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/itcl/itk/library/itk.tcl b/itcl/itk/library/itk.tcl index 54ef1ec507b..dea0f669bb6 100644 --- a/itcl/itk/library/itk.tcl +++ b/itcl/itk/library/itk.tcl @@ -25,6 +25,26 @@ if {$tcl_platform(os) == "MacOS"} { lappend auto_path ${itk::library} } +# ---------------------------------------------------------------------- +# USAGE: itk::remove_destroy_hook <widget> +# +# Used internally via "itk_component delete" when disconnecting a +# component <widget> from the mega-widget that contains it. +# Each component has a special binding for the <Destroy> event +# that causes it to disconnect itself from its parent when destroyed. +# This procedure removes the binding from the binding tag list and +# deletes the binding. It is much easier to implement this in +# Tcl than C. +# ---------------------------------------------------------------------- +proc ::itk::remove_destroy_hook {widget} { + set tags [bindtags $widget] + set i [lsearch $tags "itk-destroy-$widget"] + if {$i >= 0} { + bindtags $widget [lreplace $tags $i $i] + } + bind itk-destroy-$widget <Destroy> {} +} + # # Define "usual" option-handling code for the Tk widgets: # |