Front page | perl.beginners |
Postings from March 2002
Perl/Tk key binding
Thread Previous
From:
Damian Sweeney
Date:
March 16, 2002 12:44
Subject:
Perl/Tk key binding
Message ID:
3C93AEE8.7070503@myrealbox.com
Hi folks,
I love this list :-). I'm new to programming and perl, but feel brave
enough to venture forth after following the list for a couple of weeks.
I'm writing a Tk script and have a little question:
I want to be able to use the 'Del' key to delete an entry in the
following listbox:
$forms_box = $forms_menu_middle->ScrlListbox(-label => "$choices
entered",
-height => 15,
-selectmode=>"browse")->pack(-side => "left");
I tried the following, but with no success:
$forms_box->bind("<Key-Delete>", sub {
$forms_box->delete("active");
});
....even though the same sub in a button works:
$forms_menu_middle->Button(-text => "Delete $choice",
-command => sub {$forms_box->delete("active");},
-relief => "raised")->pack(-side => "right");
I've managed to get "<Key-Delete>" working in an Entry widget, and I've
tried more basic commands in the sub, namely {print "help";}, but the
sub doesn't appear to be invoked at all. The only thing I can think of
is that the ScrlListbox widget doesn't accept key bindings, but I can
find no mention of it in the docs. Any thoughts?
Thanks in advance and keep up the good work.
Damian.
Thread Previous