KuntalBhusan has asked for the wisdom of the Perl Monks concerning the following question:
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'); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to control a Tk::AbstractCanvas with a second one
by Anonymous Monk on Nov 29, 2012 at 09:33 UTC | |
by Anonymous Monk on Nov 29, 2012 at 09:34 UTC | |
by Anonymous Monk on Nov 29, 2012 at 10:44 UTC | |
by KuntalBhusan (Acolyte) on Nov 29, 2012 at 14:57 UTC | |
by Anonymous Monk on Nov 29, 2012 at 15:01 UTC | |
by KuntalBhusan (Acolyte) on Nov 30, 2012 at 05:05 UTC |