TIP: Click on subject to list as thread! ANSI
echo: delphi
to: ROLF BLUM
from: RYAN POTTS
date: 1997-11-13 11:21:00
subject: Re: Forms opening with App

Rolf Blum wrote in a message to Derek Grainger:
 RB> I cannot anymore design them in   the IDE?
 RB> Kind regards
Here is hoe I create forms manually.  Manually creating forms allows for a 
MUCH faster loading program.
Say I have a form class called tForm1:
Instead of having 
Var
   Form1 : tForm1;
In the interface I delete that and replace it with a prototype procedure or 
function ie:
procedure ThisIsMyForm;
Then at the top of the implementation section I have the following 
procedure/function:
procedure ThisIsMyForm;
begin
  with tForm1.create(nil) do
    try
      Showmodal;
    finally
      free;
    end;
end;
You can get more fancy by passing in parameters etc.  Now from the calling 
procedure instead of saying Form1.Showmodal, you just say ThisIsMyForm.  I 
like this method a lot as it allows for a quick means to reset a form to its 
design time state, simply leave the form and then return without exiting the 
program.  Everytime ThisIsMyForm is called it fires the OnCreate event, 
OnShow etc etc..
Another method that does Var the form:
Interface
.
.
.
Var 
   Form1 : tform1;
   procedure ThisIsMyForm;
implementation
procedure ThisIsMyForm;
begin
   form1 := tForm1.create(application);
   with form1 do
     try
       showmodal;
     finally
       free;
     end;
end;
This way you can make referance to items in Form1 form procedures/functions 
that are not in the form class....
Thanks,
           Ryan 
---
---------------
* Origin: Midnight Express, Fairlawn Ohio (1:157/110)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.