Subject Re: [IBO] IB_Query-Destroy Message
Author Frank Ingermann
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)
procedure Notification(aComponent:TComponent; Operation:TOperation);

(in implementation)
procedure TMyCompo.Notification(aComponent:TComponent; Operation:TOperation);
if (aComponent = fMyDataSet) and (Operation=opRemove) then
fMyDataSet := NIL;


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,