[plt-scheme] graph-pasteboard

From: Robby Findler (robby at cs.uchicago.edu)
Date: Mon Sep 11 08:29:10 EDT 2006

At Mon, 11 Sep 2006 12:52:21 +0200, nik gaffney wrote:
> hi,
> 
> while using the graph-pasteboard, it looks like the on-delete method in the
> graph-pasteboard-mixin should handle the removal of nodes from a graph, as
> well as deleting the snip from the clipboard.
> 
> perhaps ->
> 
> (define/augment (on-delete snip)
>   ;; remove from parent list of children
>   (for-each (lambda (child)
>               (send child remove-parent snip))
>             (send snip get-children))
>   ;; remove from child list of parents
>   (for-each (lambda (parent)
>               (send parent remove-child snip))
>             (send snip get-parents)))
> 
> is there a reason why this would only be done in an class using the mixin,
> rather than by default?

Insertion and removal of snips in that pasteboard doesn't update the
graph structure in general. Its done separately, so that you can have a
snip be in the graph, but (probably temporarily) not visible.

If you do want to remove a snip from the graph, you probably want to
use remove-parent and remove-child, instead of the above.

Robby



Posted on the users mailing list.