I have this bug in delphi i'm inherating from different forms (3 in total) and when i'm creating the last child, it creates every component 3 times. It's dll project and the dll makes the different forms. I have a launcher for testing that dll. On calling the function that creates the form needed it creates all 3 of them in one window (screen below). I have tried giving my components the same name. It doesn't show any errors on compiling the dll but on calling the function from the launcher it says that this or that component already exists, so i had to give all my components different names. (If it's not clear please ask me questions i don't know how to explain it more clearly)
Here are my form definitions:
TFrmReserve007 = class(TfrmRsrvExtended)
private
{ Private declarations }
[...]
protected
{ Protected declarations }
[...]
public
{ Public declarations }
[...]
end;
TfrmRsrvExtended = class(TfrmRsrv)
Act_Browse2: TAction;
Act_SaveAs2: TAction;
Act_LoadDefault2: TAction;
ImageListToolbar2: TImageList;
PSCMandatoryObjects2: TPSCMandatoryObjects;
ImageListMouvement2: TImageList;
[...More components...]
TopPanel2: TPSCTopPanel;
procedure Act_BrowseExecute(Sender: TObject);
procedure Act_LoadDefaultExecute(Sender: TObject);
procedure Act_loadSenderExecute(Sender: TObject);
procedure bbtn_Browse2Click(Sender: TObject);
private
{ Private declarations }
[...]
protected
[...]
public
{ Public declarations }
[...]
end;
TFrmRsrv = class(TForm)
PSCButtonPanel1: TPSCButtonPanel;
PageControl: TPageControl;
TabSheeta: TTabSheet;
[.. More components...]
Act_LoadKeyWord1: TAction;
Act_LoadStorage1: TAction;
Mandatory1: TPSCMandatoryObjects;
PSCHint: TPSCHint;
{$ENDREGION}
private
{ Private declarations }
protected
{ Protected declarations }
[...]
public
{ Public declarations }
[...]
end;
This [...] means there are functions and procedures there.
And here's the screen i have when calling the form creating with TFrmReserve007.Create(nil)
MCVE
LAUNCHER
procedure setLXCom;
begin
if lxPom59Svc = nil then
begin
ClassID := ContractIDToClassID('pom59PumaToRio@dtad');
IU := CreateLynxObject( ClassID);
if IU = Nil then begin
raise Exception.Create( 'CreateLynxObject failed');
end;
IU.QueryInterface( Ipom59Svc, lxPom59Svc);
if lxPom59Svc = nil then
begin
raise Exception.Create( 'QueryInterface ILynxRio failed');
end;
end;
end;
procedure TForm1.Button11Click(Sender: TObject);
begin
setLxCom;
lxPom59Svc.RioSvcGui007V2(
LxPom59Svc.RioGetDataPCE007V2('9051','2010010281',false),lgFRENCH)
end;
DLL
function tl_pom59Svc.RioSvcGui007V2(
Info: IInfoNotisReservation;For007:boolean;Extension:string; ParentWindow: HWND)
: IInfoNotisReservation;
var
Ok : Boolean;
untKey: String;
canSave : Boolean;
begin
Ok := False;
GetRioDB(fRegister);
untKey := RioN.GetRegisterByID(RioN.RegisterID, FLAG_IGNORE_SECURITY).Data.UnitID.Value;
canSave := RioN.GetPieceAccess(info.pieceID).Edit;
While Not(Ok) do
begin
Ok := true;
case LoadFRM_ReservationMod007(Info,
fRegister, UntKey, canSave, For007, Extension,Parentwindow) of
TR_Ok :
begin
Result := Info;
end;
TR_Cancel :
begin
Result := Nil;
end;
else
Result := Nil;
end;
end;
end;
Function LoadFrm_ReservationMod007(var InfoReservation : IInfoNotisReservation;
Reg_Key,Unt_Key:string;CanSave:Boolean;For007:boolean;Extension:string; ParentWindow: HWND):TTrilean;
var
Frm_ReservMod007: TFrmReserve007;
begin
Frm_ReservMod007 := TFrmReserve007.Create(nil);
FRM_ReservMod007.ShowModal;
if Frm_ReservMod007.ModalResult <> Mrcancel then
begin
InfoReservation.Assign(Frm_ReservMod007.InfoReserv);
Result := TR_Ok;
end
else
begin
InfoReservation := Nil;
Result := TR_Cancel;
end;
end;