Subject | Re: [IBO] IB_Query-Destroy Message |
---|---|
Author | guido.klapperich@t-online.de |
Post date | 2001-05-04T23:29:54Z |
Great, that's it. Thanks Frank.
Guido.
PS: Es wird langsam Zeit ins Bett zu gehen :-)
Frank Ingermann wrote:
Guido.
PS: Es wird langsam Zeit ins Bett zu gehen :-)
Frank Ingermann wrote:
> Hi Guido,
>
> guido.klapperich@... wrote:
> >
> > Send a IB_Query any message before it get destroyed ? The background is
> > this, that I have self-written component with a property Dataset:
> > TIB_BDataset. When I set Dataset:=IB_Query1 for example and then delete
> > IB_Query1, I get an AV, so I need to know, if the Query has been
> > deleted. Any ideas ?
> >
> > Guido.
>
> i don't know if it sends a message, but the "pure oop" approach will surely
> work: you should override the Notification method of your self-written compo.
> something like:
>
> (in interface)
> public
> procedure Notification(aComponent:TComponent; Operation:TOperation);
> override;
>
> (in implementation)
> procedure TMyCompo.Notification(aComponent:TComponent; Operation:TOperation);
> begin
> if (aComponent = fMyDataSet) and (Operation=opRemove) then
> fMyDataSet := NIL;
>
> inherited;
> end;
>
> when the IB_Query1 gets destroyed, Delphi calls the Notification meth for all
> other compos (this is the "say hello, wave goodbye" meth :-) so you can detect
> in your compo that something it points to is about to be destroyed.
>
> one of the things that make hatching objects a bit unpleasant - if you don't
> provide a way to clean up dangling references, they'll just dangle into AVs ;)
>
> regards & hope this helps,
> fingerman
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/