Forum > Beginners

Creating a project with forms from other projects


I am trying to create a new project with forms I have modified from older existing projects.  I created a new file directory for the new project and saved the existing form into the new directory using “save as” and giving it a new name.  Lazarus then asked me if I wanted to delete the old version of the form.  I chose the “No” option. But then when I ran the new project I got an error saying that Lazarus could not find the new form.  I can see that I am out of my depth here and am asking for help to:(1) either recreate the forms and save them in the new directory, or (2) is there a way to use the old forms, changing the name, and saving them into the new directory, or (3) copying the form, piece by piece onto a new form and save that new form to the new directory, or (4) what is the proper way to do this and not generate error messages?
Thank you in advance for any assistance you can provide.

Hold  on for a bit, I'll put together an example for you  ;)
Regards Benny

if you copy the form files into the new project folder you can add them to the new project. Start lazarus, menu Project, Project inspector. In the project inspector you choose add, add file from the file sytem, select you're form file.

Right, here goes:  %)
1) My development tree starts at ~/src (on windows it's probably C:\src)

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---           - my_rtl/ this directory contains my own RTL, ex: my_advstring.pas, my_bomintf.pas~/src/-|           - my_fcl/ this directory contains my own FCL, ex: lfm_editaccitem.pas/lfm       |   - frmreuse/ contains this test project 2) When I develop something that can be reused, I place it in one of the
    libdirs, my_rtl or my_fcl
3) For forms, just copy the .pas and the .lfm files to ~/src/my_fcl/
4) In your new Project, go to: Project Options -> Compiler Options -> Paths
-> Other unit files and add your two libdirs
5) Now, you can: 1- add to uses in lpr for the new project; 2- add to uses
    per form or unit basis, as per my example app.
6) Example project uses an inputform from another app of mine, but from
    the main form not lpr. It gets created by a function in the input-unit
    instead of autocreation in lpr.
7) Play around with it and have fun  :D
Got questions?!? just ask  ;)
Regards Benny


[0] Message Index

Go to full version