Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi all.
I want to do some conditional callbacks in Perl Tk. There is documentation how to define callbacks (callbacks.pod). But there is no documentation how to store and call such callbacks. I investigated some code and found something about Tk::Callback.
Look at this piece of code:
my $script = ['call_handler', $param]; # see callbacks.pod $widget->bind($widget, '<Key-Home>', $script); # Standard my $callback = Tk::Callback->new($script); # Create manually $callback->Call($widget); # Invoke sub call_handler { my ($widget, $param) = @_; }
Unfortunately the code does not work as expected. The parameters in the second case will be passed in a wrong order. ($param, $widget instead of $widget, $param). Is there any reasonable method to keep compatibility of call_handlers with the bind?
|
|---|