Under the module description part of Tk::Abstract Canvas, I can find the topic "updating a second AbstractCanvas which is displaying the view region of the first AbstractCanvas" and a code example too, but I cannot figure out how to implement the same.
My code is something like this :Where should I now use this code part as described in the Module help of Tk::AbstractCanvas$abstractcanvas1 = $SomeFrame->Scrolled(qw/ AbstractCanvas -bg white -confine 1 -scrollbars se/, )->pack(-fill => 'both',-expand => 1); $can = $abstractcanvas2->Subwidget('scrolled'); $abstractcanvas2 = $SomeFrame->Scrolled(qw/ AbstractCanvas -bg white -confine 1 -scrollbars se/, )->pack(-fill => 'both',-expand => 1); $can = $abstractcanvas2->Subwidget('scrolled'); ## code to display the network in $Canvas1
And how to do it ?? Thanks, Kuntal$abstractcanvas2 = $f_Left->Scrolled(qw/ AbstractCanvas -bg white -confine 1 -scrollbars se/, )->pack(-fill => 'both',-expand => 1); $can_1 = $abstractcanvas2->Subwidget('scrolled'); $abstractcanvas1->configure(-changeView => [\&changeView, $abstractcan +vas2]); # viewAll if AbstractCanvas2 widget is resized. $abstractcanvas2->CanvasBind('<Configure>' => sub {$abstractcanvas2- +>viewAll}); { my $viewBox; sub changeView { my ($canvas2, @coords) = @_; $canvas2->delete($viewBox) if $viewBox; $viewBox = $canvas2->createRectangle(@coords, -outline => 'orang +e'); } }
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |