Well you don't show any code, but here is something to play with. Tab around the widgets, or force focus to a canvas. Otherwise, show a minimal working code example, and say what you want it to do.
#!/usr/bin/perl
use strict;
use Tk;
use Tk::Pane;
my $mw = MainWindow->new;
$mw->geometry('400x250');
my $mwf = $mw->Scrolled('Pane',
-scrollbars=>'osoe',
-sticky=>'nwse',
)->pack(-expand=>1, -fill=>'both');
my $f1 = $mwf->Frame()->pack();
my $f2 = $mwf->Frame()->pack();
my %canv;
for (0..4){
$canv{$_}{'obj'} = $f1->Scrolled('Canvas',
-height => 100,
-width => 100,
-bg =>'white',
-scrollbars => 'osoe',
-scrollregion => [ 0, 0, 500, 500 ],
)->pack(-side =>'left' ,-padx=>10,-pady=>10);
$canv{$_}{'obj'}->createText(50,50,
-text => $_,
-anchor => 'center',
);
my $num = $_;
$canv{$num}{'obj'}->CanvasBind( '<FocusOut>' => sub{
$canv{$num}{'obj'}->configure(-bg=>'lightyellow');
} );
$canv{$num}{'obj'}->CanvasBind( '<FocusIn>' => sub{
$canv{$num}{'obj'}->configure(-bg=>'lightgreen');
} );
}
for (5..9){
$canv{$_}{'obj'} = $f2->Scrolled('Canvas',
-height => 100,
-width => 100,
-bg =>'white',
-scrollbars => 'osoe',
-scrollregion => [ 0, 0, 500, 500 ],
)->pack(-side =>'left', -padx=>10,-pady=>10 );
$canv{$_}{'obj'}->createText(50,50,
-text => $_,
-anchor => 'center',
);
my $num = $_;
$canv{$num}{'obj'}->CanvasBind( '<FocusOut>' => sub{
$canv{$num}{'obj'}->configure(-bg=>'lightyellow');
} );
$canv{$num}{'obj'}->CanvasBind( '<FocusIn>' => sub{
$canv{$num}{'obj'}->configure(-bg=>'lightgreen');
} );
}
my $button = $mw->Button(-text=>'Focus 1',
-command => sub{
$canv{1}{'obj'}->focusForce;
$canv{1}{'obj'}->configure(-bg=>'blue');
})->pack();
MainLoop();
| [reply] [d/l] |