Hi, <br><br>Here is a simple example;<br><br>let me know how you go<br><br>Cheers, <br><br>Stephen<br><br><br><br>;; <br>(module graph-demo mzscheme<br> (require <br> (lib "mred.ss" "mred")<br> (lib "
graph.ss" "mrlib")<br> (lib "class.ss")<br> )<br><br> (define the-frame<br> (new frame% ;<br> (label "graph-demo")<br> (width 600)<br> (height 600)))<br><br>
;; add the matching descriptions list box<br> (define the-editor-canvas (instantiate editor-canvas% (the-frame)))<br> (define draw-lines-pasteboard% (class (graph-pasteboard-mixin pasteboard%) ;<br> (super-new)
<br> (define/public (add-issue issue)<br> (let* ((issue-snip (make-object my-graph-snip% issue))<br> )<br> (send this insert issue-snip)
<br> issue-snip))))<br> <br> (define the-graph-pasteboard (instantiate draw-lines-pasteboard% ()))<br> (send the-editor-canvas set-editor the-graph-pasteboard)<br> <br> (define my-graph-snip% (graph-snip-mixin string-snip%)) ;; use string-snip%
<br> ; I'm playing with a decorated editor snip at the moment so I can edit the text <br> ; of a snip in-place, and have a cute little icon, all in a nice box.<br> <br> ;; does what it says on the can.<br> (define (connect parent child)
<br> (define dark-pen (send the-pen-list find-or-create-pen "blue" 1 'solid))<br> (define dark-brush (send the-brush-list find-or-create-brush "blue" 'solid))<br> (define light-pen (send the-pen-list find-or-create-pen "light blue" 1 'solid))
<br> (define light-brush (send the-brush-list find-or-create-brush "light blue" 'solid))<br> (add-links parent child<br> dark-pen light-pen<br> dark-brush light-brush "-->to-->" ))
<br> <br> (define aaa (send the-graph-pasteboard add-issue "aaa"))<br> (define bbb (send the-graph-pasteboard add-issue "bbb"))<br> (define ccc (send the-graph-pasteboard add-issue "ccc"))
<br> (define ddd (send the-graph-pasteboard add-issue "ddd"))<br> <br> (connect aaa bbb)<br> (connect ccc bbb)<br> (connect ddd bbb)<br> (connect aaa ddd)<br> <br> (send the-frame show #t) <br> <br> (define-values (width height) (send the-editor-canvas get-client-size))
<br><br> (printf "width:~a height:~a" width height)<br> (define (random-position extent)<br> (+ 30 (random (- extent 60)))<br> )<br> (send the-graph-pasteboard move-to aaa (random-position width) (random-position height) )
<br> (send the-graph-pasteboard move-to bbb (random-position width) (random-position height))<br> (send the-graph-pasteboard move-to ccc (random-position width) (random-position height))<br> (send the-graph-pasteboard move-to ddd (random-position width) (random-position height))
<br> <br> <br> )<br><br><br><br clear="all"><br>-- <br>Cheers,<br><br>Stephen<br><br><br><br>--<br>Stephen De Gabrielle<br><a href="mailto:s.degabrielle@ucl.ac.uk">s.degabrielle@ucl.ac.uk</a><br>Telephone +44 (0)20 7679 5242 (x45242)
<br>Mobile 079 851 890 45<br><a href="http://www.uclic.ucl.ac.uk/annb/MaSI.html">http://www.uclic.ucl.ac.uk/annb/MaSI.html</a><br>University College London Interaction Centre<br>Remax House - 31/32 Alfred Place
<br>London - WC1E 7DP