Question : Problem calling 2 forms in the same DLL

Hello!

In a DLL i have a form, where i can navigate in a specific folder of my system...
Ok, think that, a .exe call this DLL and Load it...
The form Appear, ok

Now clicking in the same button, the Form will appear again, but, PAM! ERROR! haha

What's happening is, when i do something in the first form, the same thing happen in the second instance of the form, but why?
And the error since, seems the same things is being used by both proccess
example, a TList create in the first instance is being used in the second instance of the form too, and PAM error!

In DLL i'm calling something like

procedure CalltheForm; StdCall;
begin
  frmName := TFrmName.Create(Nil);
  frmName.Show;
end;

Making some tests, i saw that, when i take some action in the first instance of the form, example, clicking in a button to navigate back, the same action happen in the second instance of the form

how to prevent it? I never got this problem very strange oO

Some idea?

Regards,
Carlos

Answer : Problem calling 2 forms in the same DLL

are you using the same form variable ?

or referencing the form variable from within the form code with it's name instead of using self ?
sample:
procedure TfrmName.Button1Click(Sender: TObject);
begin
  frmName.Caption := 'Button 1 clicked';
end;

--> change to
procedure TfrmName.Button1Click(Sender: TObject);
begin
  Self.Caption := 'Button 1 clicked';
end;
Random Solutions  
 
programming4us programming4us