Link to home
Start Free TrialLog in
Avatar of VSF
VSFFlag for Brazil

asked on

Form instance!

This is a easy one for you experts,

Let's say I have 3 forms on my project, they all look like the same, and their functionality to the end are quite similar.
The main difference between them is that they access diferent databases and have some different form captions.

I want to be able to create only one form at design time and then instanciate the forms as MDIChilds at runtime so that to the end user he will think that there are 3 different forms running.

I want to open different instances of the form at the same time, and want to be able to track if the especific instance is already open.

Hope you guys can help me!
Thanks,
VSF
www.victory.hpg.com.br
ASKER CERTIFIED SOLUTION
Avatar of Wim ten Brink
Wim ten Brink
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Radler
Radler

Hi VSF,

Saw your email and my conclusione is that you is Brazilian, Rigth!?

See this

procedure ShowSpecific( ACaption, DatabaseDir : string );
var
   Dlg : TMyDialog;
begin
   Aplication.CreateForm( TMyDialog, Dlg );
   try
       Dlg.Database1.Directory:=DatabaseDir;
       Dlg.Caption:=ACaption;
       Dlg.Table1.Open();
       Dlg.ShowModal();  //Replace to show and see *
   finally
       Dlg.Free();   //To modal form only
   end;
end;

* To a MDI Form erase the Dlg.Free and assign a Action:=caFree into the onClose event.

T++, Radler;

Feliz Páscoa.
Avatar of VSF

ASKER

This should do it!