• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 390
  • Last Modified:

dfm 2 pas????

I have a lot of quickreports(48). This will create a system resource shortage. I want to create my reports in runtime.
But I really don't want to write the code myself.
Can anyone send me a utility that can convert a form file and turn it in to a .pas-file that creates the report, runs it. And then free the memory. The person that sends me such a utility or tells me where to find it will get the points.

regards,
Dr. Gonzo
0
dr_gonzo
Asked:
dr_gonzo
1 Solution
 
MadshiCommented:
Hi Dr. Gonzo,

I'm sorry, I don't know such a utility. How about this: You could right click on your form, view the form as text (I don't know the exact english menu item). Then you could copy this sources into your pas unit. Now you can rebuild the form in runtime. Of course it's still a lot of work. But I know no better way...   :-(

Regards, Madshi.
0
 
dr_gonzoAuthor Commented:
Yeah but I wouldn't like that.
48 reports. yeach hell no.
Someone must have had this kinds of
problem before. Do I have to make this
util myself?
0
 
kretzschmarCommented:
Hi dr_gonzo,

maybe, this helps a little
ftp://ftp.is.co.za/programming/delphi/d30free/formread.zip

meikl

0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
earthwormCommented:
You don't need any thing,I think.
You can create these Forms only at runtime,like this:
(1)Set these forms to available forms but bot auto-create forms:select the menu "project"->"Options",now you will see a page named "forms" and two listbox in it. The  left one contain the auto-create forms and the right one   contain the available forms. NOW,select the forms you don't want to create and click the button ">>" ,so the application will NOT create them
(2)Use them at runtime:
e.g:
begin
{....}
  //create the form
  with AForm.Create do
  try
    //show it or use it as you want
    ShowModal;
  finally
    //now you can free it and take back the resource
    Free;
  end;
{....}
end;

0
 
Laci030999Commented:
Dr. Gonzo,

Well this is not the utility you have asked for, but I use many reports too and this is an esy way to create them at runtime:


-> this could be a procedure to create and show/print reports

procedure ShowReport(Report: TQuickRep; FormClassType: TComponentClass);
begin
   Screen.Cursor:= crHourGlass;
   Application.CreateForm(FormClassType, Report);

   try
     Screen.Cursor:= crHourGlass;
     Report.PreviewModal; //or Print;
   finally
     Report.Free;
     Screen.Cursor:= crDefault;
   end;
end;

(QuickRpt needs to be added to the uses list of the unit of this procedure)


-> this is how to use it at the places where you would call "Report.Preview /.Print"

procedure TMainForm.ShowReport48_ButtonClick(Sender: TObject);
begin
  ShowReport(QuickReport48,TQuickReport48);
end;

(I like clean, simple code, but this far I couldn't find a way to get rid of the second parameter.)


So my suggestion is to change the code a bit, but using the clipboard and hot keys it shouldn't take long.

Regards,
Laci.


PS: Hope you have no trouble understanding my English. :-)
0
 
Laci030999Commented:
I have just noticed that it's been quite a while when the last comment was added, maybe you have the solution by now.  ;-)

Laci
0
 
Laci030999Commented:
Ooops, looks like I copied the wrong version of the example to the my comment!

-> this is the correct procedure

procedure ShowReport(Report: TQuickRep; FormClassType: TComponentClass);
begin
         try
           Screen.Cursor:= crHourGlass;
           Application.CreateForm(FormClassType, Report);
           Report.PreviewModal; //or Print;
         finally
           Report.Free;
           Screen.Cursor:= crDefault;
         end;
end;

Regards,
Laci.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now