Solved

dfm 2 pas????

Posted on 1999-01-28
7
374 Views
Last Modified: 2010-04-06
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
Comment
Question by:dr_gonzo
7 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 1363644
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
 

Author Comment

by:dr_gonzo
ID: 1363645
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
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1363646
Hi dr_gonzo,

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

meikl

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Accepted Solution

by:
earthworm earned 460 total points
ID: 1363647
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
 

Expert Comment

by:Laci030999
ID: 1363648
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
 

Expert Comment

by:Laci030999
ID: 1363649
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
 

Expert Comment

by:Laci030999
ID: 1363650
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi 10 Seattle Dataset Actions 5 79
FMX enumerated colours 2 84
Magic Software info 18 126
Dev Express grid collapse 2 39
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now