> There is a really weirdo thing happening on myapp that I have been buggering
> around with for the last 3 hours. What happens is that the mainform calls a

>   with TfrmCapture.Create(Application) do
>   try
>     ShowModal;
>   finally
>     Free;
>   end;

nowhere in this code does a TFormCapture object get assigned to frmcapture.
Note that the type and the handle are different.

the code

> procedure TfrmCapture.btnCaptureClick(Sender: TObject); // Modal form
> begin
>   frmcapture.WindowState:=wsMinimized;
>   frmcapture.Visible:=false;

should really be

procedure TfrmCapture.btnCaptureClick(Sender: TObject); // Modal form
begin
  WindowState:=wsMinimized;
  Visible:=false;

NB: there is an implied self. in front of the WindowState

> The next time the modal call is used with mainform on the tray the following
> lines dont work:

Look in the dfm file and you'll find something like:

Application.CreateForm(TFrmCapture,frmCapture);

remove it if you're creating resources on the fly (the best way IMHO)

You should also remove the

var
  frmCapture :TFrmCapture

from the unit containing the TfrmCapture definition.  Always use self rather than
the frmCapture handle inside any procedures or functions of TFrmCapture since
your code is then more easily adjusted should you ever want multiple copies of
the form.

> The frmcapture form is there, visible, and  I can move the modal box around.
> It wont go away even though de bugger shows the lines are executed. I have
> checked to see if the form is re-created, but no, its just like the above
> lines dont mean anything. Any ideas? its got me stuffed.

He he... the form object created in the dfm file is the one you've minimised but then
it was never shown... 

Niggly one to find if you've done this... No debugger is gonig to show you this except
that the pointer value of self and frmcapture will be different showing that there are 
in
fact 2 forms...

--
Aaron Scott-Boddendijk
Jump Productions
(07) 838-3371 Voice
(07) 838-3372 Fax


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to