Delphi FMX button calling a dll form dosent wait till the form is finished with before exiting routone

  

I have a dll that creates a form and uses strings passed to it to set up variables for database connections. This all works fine. My problem is on my main form I need to refresh some DB tables when the dll form is closed. How do I do this.

my dll is

library Contact;

uses
System.SysUtils,
System.Classes,
FMX.Forms,
NewContact in ‘NewContact.pas’ {FMNewContact};

{$R *.res}

procedure NewContactShow(Title: string;
Table: string;
Connection: String;
Param: TStrings); StdCall export;
begin
FMNewContact := TFMNewContact.Create(nil); // creates the form
FMNewContact.TableName := Table;
with FMNewContact do
begin
Caption := Title;
FDConnect.ConnectionName := Connection;
FDConnect.Params.Text := Param.Text;
FDConnect.Connected := True;
Saved := False; //Flag to say the Form new data has been saved to db table;
Show;
end;
end;

function GetStatus(): Boolean;
begin
Result := FMNewContact.Saved; // get status of flag before destroying form.
FMNewContact.Destroy;
end;

exports
NewContactShow,
GetStatus;

begin
end.

In my Main form

procedure TForm1.NewBttnClick(Sender: TObject);
begin
try
// Creates the form and displays in fine.
NewContactShow(‘Enter New Employee’,
‘Employee’,
FDTimeCard.ConnectionName,
FDTimeCard.Params);
finally
// This destroys the form before user can deal with it
if GetStatus then
BuildEmployeeTable();
end;
end;

If I remove the GetStatus check Tables are updated prior to the user entering infomation on the dll form

So goal is

I need to call Dll form.
Wait till user saved data on form.
Update Table on screen.

Comments are closed.