Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-19 16:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found