Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Dear Monks, I want to create two Tk::Abstract canvases. One (lets call it Canvas1) would display a huge graph (consisting of nodes and edges) and other small canvas (lets call it Canvas2) which will contain a smaller view of the same graph (using the ViewAll function of AbstractCanvas). I want to use some simple interactions like a small rectangle in Canvas2 to scroll and view the big network of Canvas1.

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 :
$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
Where should I now use this code part as described in the Module help of Tk::AbstractCanvas
$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'); } }
And how to do it ?? Thanks, Kuntal

In reply to How to control a Tk::AbstractCanvas with a second one by KuntalBhusan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (6)
    As of 2014-07-12 01:50 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      When choosing user names for websites, I prefer to use:








      Results (238 votes), past polls