Solved

dfm 2 pas????

Posted on 1999-01-28
7
372 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
Comment Utility
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
Comment Utility
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
Comment Utility
Hi dr_gonzo,

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

meikl

0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Accepted Solution

by:
earthworm earned 460 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

7 Experts available now in Live!

Get 1:1 Help Now