9.5. How do I add bindings?

On Fri, 15 Sep 95 10:30:56 BST Nick Ing-Simmons <Nick.Ing-Simmons@tiuk.ti.com> writes:


Re: Multiple binds to a single widget?
**************************************

On Thu, 14 Sep 1995 14:57:54 -0400
Alain St <astdenis@cmc.doe.CA> writes:
!In the tcl/tk doc I have, they say that prepending the script 
!with '+' appends the new binding to the current one.
!
!How do I do that in perlTk? 
!
You cannot do that that way (yet?) - one issue is what it would mean to prepend '+' to a perl/Tk callback :
    $widget->bind('<A>','+',[\&subname,$arg]); 
    # did not look right to me
Other issue is that I would need to manage a list-of-callbacks in glue code.

Bind your new command to a new tag:

    $widget->bind('Extra',....);
And add Extra to the widgets bindtags:
    $widget->bindtags([ref($widget),$widget,'Extra',$widget->toplevel,'all']);

Previous | Return to table of contents | Next