A couple of ways you can do this:

a)      with Tb4winForm.Create(nil) do
        try
                SetSomePropertyExposedOnTb4winForm := whatever;
                ShowModal;
        finally
                Free;           <- Free is the more standard way of freeing
a form.
                                   You should be reasonably guaranteed that
all
                                   event handlers on your form are finished
by the
                                   time ShowModal returns.
        end;

b)      with Tb4winForm.Create(nil) do
        try
                FormClosed :=
DoSomethingWithFormIncludingShowingItModally(whatever);
        finally
                Free;
        end;

        i.e.  Create a public 'wrapper' method in your Tb4winForm which 
        has whatever signature you like parameter-wise, wraps the call to
        ShowModal and returns the return value of ShowModal as the result
        of your wrapper method.

Drop me a line if it doesn't make sense.

HTH,

Conor

-----Original Message-----
From: Alistair George [mailto:[EMAIL PROTECTED]]

[snip]

Q2: I want to pass some parameters to a showmodal form; How to do please:
procedure TMainform.About1Click(Sender: TObject);
begin
  with Tb4winForm.Create(nil) do
  try
    ShowModal;
  finally
    release;
  end;
end;

Should I just declare a global variable from within the caller routine, or
can I
(preferably) pass the parameter within the above code?

[snip]
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to