[plt-scheme] adding children

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Apr 7 14:49:11 EDT 2005

At Wed, 6 Apr 2005 11:33:15 -0500, Corey Sweeney wrote:
> How do controlls normally register with their parent?  they don't seem
> to call add-child in the parent.  for example, i tried inheriting from
> a panel, then overriding add-child.
> 
> (override*     
>    (add-child
>       (lambda (decoy ...) (display "intercepted add!"))))
> 
> 
> if i call (send new-object add-child) it works, but if i do
> (new message% (label "stuff") (parent new-object))
> 
> then it automatically adds to the inherited vertical-panel, without
> ever calling add-child.  (I'm trying to intercept the add request, and
> get the requested object to add to a panel thats a child of the
> inherited vertical-panel)

There's currently no way to intercept the addition. You can override
`after-new-child' to get a notification when a child is added, though.

Matthew



Posted on the users mailing list.