Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

my $top = new MainWindow();
my $tree = $top->ScrlTree();
$tree->bind(ref($tree), '<ButtonPress>', sub { die });
$top->bind(ref($tree), '<ButtonPress>', sub { die });
# Populate Tree...
MainLoop
For some reason this doesn't seem to work. It should die when I click the mouse on the tree, but it doesn't do anything at all. What is wrong?

Replies are listed 'Best First'.
(tye)Re: Binding events in Tk
by tye (Sage) on Jan 14, 2001 at 06:02 UTC

    In my experience, die while in Tk doesn't do anything visible unless you are looking at the "console" window where Perl error messages go to.

            - tye (but my friends call me "Tye")
      Hmm...Changing it to
      sub { $tree->messageBox(-message=> "foo") }
      doesn't seem to help.