--kibhcjbkgfdj-netman.eng.auburn.edu-02636-0
Content-Type: text/plain; charset=us-ascii
>
>Hi Doug,
>
>Sorry to bother with a simple question, but I was trying to run
>your sample snmptraceroute script you posted on the tkined list.
>There are two proc that are called(mkNode mkEdge) that are not
>included in the sample script. Are these two procedures something
>you wrote yourself to create the canvas objects or are they provided
>with the tk source demo scripts. I seem to recall seeing something
>similiar a while back but I can't find these two proc in my distribution.
>
>Thanks,
>jb
Oops! I forgot that that program automatically includes routines from
another tcl file via tclIndex
Here's the included (graph.tcl) - you'll need to do a
auto_mkindex . *.tcl to get it to autoload.
-- ____________________________________________________________________________ Doug Hughes Engineering Network Services System/Net Admin Auburn University doug@eng.auburn.edu--kibhcjbkgfdj-netman.eng.auburn.edu-02636-0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-Description: graph moving and node making file
#!/opt/local/bin/wish -f
proc mkNode {x y name} { global nodeX nodeY edgeFirst edgeSecond curX curY set new [.c create oval [expr $x-10] [expr $y-10] \ [expr $x+10] [expr $y+10] -outline black \ -fill white -tags $name] set nodeX($new) $x set nodeY($new) $y set edgeFirst($new) {} set edgeSecond($new) {} .c bind $name <Button-2> { set curX %x set curY %y set tagn [lindex [.c gettags [eval .c find closest $curX $curY]] 0] set tags [.c find withtag $tagn] }
.c bind $name <B2-Motion> { moveNode $tags [expr %x - $curX] [expr %y - $curY]
set curX %x set curY %y } return $new }
proc moveNode {nodelist xDist yDist} { global nodeX nodeY edgeFirst edgeSecond foreach node $nodelist { .c move $node $xDist $yDist incr nodeX($node) $xDist incr nodeY($node) $yDist foreach edge $edgeFirst($node) { .c coords $edge $nodeX($node) $nodeY($node) \ [lindex [.c coords $edge] 2] \ [lindex [.c coords $edge] 3] } foreach edge $edgeSecond($node) { .c coords $edge [lindex [.c coords $edge] 0] \ [lindex [.c coords $edge] 1] \ $nodeX($node) $nodeY($node) } } }
proc mkEdge {first second} { global nodeX nodeY edgeFirst edgeSecond set edge [.c create line $nodeX($first) $nodeY($first) \ $nodeX($second) $nodeY($second) ] # -arrow last -arrowshape {20 25 5}] .c lower $edge lappend edgeFirst($first) $edge lappend edgeSecond($second) $edge return $edge }
canvas .c -width 600 -height 300 pack .c
#bind .c <Button-1> {mkNode %x %y node} #.c bind node <Any-Enter> { # .c itemconfigure current -fill black #} # #.c bind node <Any-Leave> { # .c itemconfigure current -fill white #} #bind .c 1 {set firstNode [.c find withtag current]} #bind .c 2 { # set curNode [.c find withtag current] # if {($firstNode != "") && ($curNode != "")} { # mkEdge $firstNode $curNode # } #} #focus .c # #.c bind node <Button-2> { # set curX %x # set curY %y #} #.c bind node <B2-Motion> { # moveNode [.c find withtag current] [expr %x-$curX] \ # [expr %y-$curY] # set curX %x # set curY %y #} #
--kibhcjbkgfdj-netman.eng.auburn.edu-02636-0--
DO NOT DELETE the above boundary line. Anything placed after this line will be ignored by MIME readers.
-- !! This message is brought to you via the `tkined & scotty' mailing list. !! Please do not reply to this message to unsubscribe. To subscribe or !! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>. !! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.