Subject | Re: [IBO] Fw: PACKAGE sample |
---|---|
Author | Geoff Worboys |
Post date | 2001-08-03T11:15:20Z |
> There is somebody who can give me some datails on how operate?It may help if you could describe what errors you get and when.
> Many thanks to all.
One common problem with this sort of thing is when the components you
assign come from different modules. You may (and probably should)
override the Notification method of your component AND use
FreeNotification calls to be sure your component is told when related
connections are destroyed.
You can read about Notification and FreeNotification in the VCL online
help, but to briefly summarise...
When components belong to the same owner (usually the form) and a
component is deleted all other components on the same owner are
notified. Components that setup relationships to other components
(such that you are doing with connections) should override the
Notification method in a manner similar to below. (I've been doing
mostly Pascal for a few months so excuse the mix of pseudo code and
bad syntax :-)
void __fastcall TMyComp::Notification(TComponent* AComponent,
TOperation Operation)
{
<call the base class Notification method>
if( Operation = opRemove )
<check if AComponent is one of the
connections you are using, is so
clear your reference>
};
If your component is likely to relate to connections on other modules
you will want to ensure that it gets notification of their
destruction. You do this by...
void __fastcall TMyComp::AddConnection(TIB_Connection *C)
{
<do whatever>
if( C && (C->Owner != Owner) )
C->FreeNotification(this);
};
In Delphi5 and BCB5 and later you can also remove the FreeNotification
as in...
void __fastcall TMyComp::RemoveConnection(TIB_Connection *C)
{
<do whatever>
if( C && (C->Owner != Owner) )
C->RemoveFreeNotification(this);
};
Maybe this is your problem, maybe not. But it could be a start.
Geoff Worboys
Telesis Computing