Arrange for callback when widget is destroyed.

## NAME

OnDestroy - Arrange for callback when widget is destroyed.

## SYNOPSIS

$widget->OnDestroy(callback);

## DESCRIPTION

OnDestroy accepts a standard perl/Tk callback. When the window associated with $widget is destroyed then the callback is invoked. Unlike $widget->('<Destroy>',...) the widgets methods are still available when callback is executed, so (for example) a Text widget can save its contents to a file.

OnDestroy was required for new after mechanism.

## SEE ALSO

destroy callbacks after bind

## KEYWORDS

destroy