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

In a recent SoPW I learned how to resolve a bind related problem in a simple example script by using bindtags. However in the actual code I am using a Scrolled tText widget and the bindtags applies to the Scrolled widget rather than the Text widget. How do I get to the actual Text widget to fix the bindtags order on it?

use strict; use warnings; use Tk; my $mw = MainWindow->new (-title => "PerlMonks node editor"); my $text = $mw->Scrolled ('Text', -font => 'normal', -wrap => 'word', -scrollbars => 'e',); $text->pack (-expand => 'yes', -fill => 'both'); $text->bindtags ([$text, ref($text), $text->toplevel, 'all']); $text->bind ('<Control i>', [\&keyCommand, 'italic']); MainLoop (); sub keyCommand { print "Got Control i\n"; Tk->break; }

DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re: Setting bindtags for a Scrolled Tk widget
by vkon (Curate) on Apr 25, 2006 at 07:51 UTC
    If you have no problem with Text widget, but having problem with same widget but wrapped to Scrolled, then "Subwidget" method may be of help for you, to reveal actual Text widget?

      Thanks for that. Just what I needed!


      DWIM is Perl's answer to Gödel