I've changed my mind. This is not really the solution I need.

The two problems with this are:

1) TComponentEditor does not have a handle so sending a user message to
close the editing form is not straightforward.

2) Now the editing form has to keep a private handle to a component editor
(set by the component editor when it created the editing form). ie. The
editing form knows about the component editor (not ideal).

The real problem is number 1. (2 is just an "in an ideal world...").

Phil.




From: "Cooke; Andrew" <[EMAIL PROTECTED]> AT tawa on 20/05/99 11:59
      ZE12

To:   Multiple recipients of list delphi <[EMAIL PROTECTED]> AT
      tawa@kauripo@CCMAIL
cc:    (bcc: Phillip Middlemiss/NZ Forest Research Institute/NZ)
Subject:  RE: [DUG]: freeing a component editor when the component i




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.

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, May 20, 1999 11:49 AM
> To:   Multiple recipients of list delphi
> Subject:      Re: [DUG]: freeing a component editor when the component i
>
> The notification method for which component?
>
> The TComponentEditor does not have such a method
>
> The TComponent.Notification method is to be notified when other
components > are deleted.
>
> The TCustomForm.Notification method might be relevant, but I don't want
> the
> editing form (see my newly posted message for a better description of my
> problem) to have to tell my TComponentEditor descendant that the
component > is no longer there. In any case, I don't think the editing form
would > recieve the notification when the component is removed because the
form > doesn't actually own it (the form being designed in the IDE does) -
it
> just
> refers to it.
>
> Thanks anyway,
>
> Phil.
> [EMAIL PROTECTED]
>
>
>
>
>
> From: [EMAIL PROTECTED] (Rohit Gupta) AT tawa on 20/05/99 11:02 ZE12
>
> To:   Multiple recipients of list delphi <[EMAIL PROTECTED]> AT
>       tawa@kauripo@CCMAIL
> cc:    (bcc: Phillip Middlemiss/NZ Forest Research Institute/NZ)
> Subject:  Re: [DUG]:  freeing a component editor when the component i
>
>
>
>
> Have a look at the method called Notification
>
> On 18 May 99 at 11:41, [EMAIL PROTECTED] wrote:
>
> > Hi,
> >
> > How do I ensure that my component editor is notified when the component
> it > is editing is about to be destroyed (or the unit closed)?
> >
>
> Rohit
>
> ======================================================================
> CFL - Computer Fanatics Ltd.  21 Barry's Point Road, AKL, New Zealand
> PH    (649) 489-2280
> FX    (649) 489-2290
> email [EMAIL PROTECTED]  or  [EMAIL PROTECTED]
> ======================================================================
>
> -------------------------------------------------------------------------
-
> -
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
>
>
>
>
>
>
>
> -------------------------------------------------------------------------
-
> -
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
---------------------------------------------------------------------------


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

Reply via email to