I can't say I really like the look of that code, but unless I'm mistaken,
you've a problem in your call to LoadPanel.

If I read your intentions right, you want LoadPanel to create an instance of
a particular form, and assign it to the object reference fForm that you pass
in.

Therefore, when you call LoadPanel from your case NewTab case statement, you
probably don't actually have a valid formOne object on which to get the
formOne.pnOne property on, which you use as your third parameter to
LoadPanel.

Unless I'm reading your code wrong...

Cheers,

C.

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


[snip]

procedure LoadPanel(vtFormClass: TFormClass; fForm : TForm; pnPanel :
TPanel);
begin
   application.createForm(vtformClass, fForm);
   pnPanel.parent := pnMain;
end;{LoadPanel}

begin
       case CurrentTab of
         tabOne : FreePanel(formOne, formOne.pnOne);
         tabTwo : FreePanel(formTwo, formTwo.pnTwo);
       end;

       case NewTab of
         tabOne : LoadPanel(TformOne, formOne, formOne.pnOne);
         tabTwo : LoadPanel(TformTwo, formTwo, formTwo.pnTwo);
       end;

But seem to fail on freeing after loading. Any idea why?
TIA
John
---------------------------------------------------------------------------
    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