Yeah, I thought I'd probably end up having to do that. I just hoped there
was a more elegant way. After all, it is still supposed to be the
TComponentEditor descendant that is managing the component, not the editing
form (ie. the editing form shouldn't really know about anything other than
editing the component).



Thanks,



Phil.

[EMAIL PROTECTED]





in responding to what Andrew Cooke wrote:

One advantage of Notification is that you can get notified _even if_ you
      don't own the component that is being destroyed. If TComponentEditor
      doesnt have such a method, you might find that having the form notify
      it is still the most elegant of the remaining options - there
      certainly don't look to be many useful methods you can employ in
      TComponentEditor!

Here's how you use it.

1. Call MyEditorForm.FreeNotification(TheComponent);
This puts MyEditorForm into the notification list of TheComponent, and also
puts TheComponent into the notification list of MyEditorForm (both are
necessary).

2. Override MyEditorForm.Notification. Call the inherited method (which
will remove TheComponent from the form's notification list). Check to see
if the component parameter is TheComponent, and send yourself a message to
close or whatever.

And that takes care of it! Notification is called from the TComponent
destructor.


Regards,
  Andrew Cooke.



---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to