Forum > Beginners

Calling a form within a project from another project

(1/4) > >>

I designed a form within a project, and tried to call it from another new project but the compiler gave me an error, how we can do it?

What was the error message? Can you show us?

The easiest probably is copy/paste the *.lfm and *.pas files to new project's folder. And then use the Project Manager > Add > File from the File System.

Actually you don't have to copy/paste those files to the new project's folder, but if you move the original source code to other location or rename that folder, you'll get error. Unless you properly manage your project folders and have a shared library folder.

I did the next steps:

project->view project source

and in project1.lpr added a line:

--- 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";}};} ---program Project1; {$mode objfpc}{$H+} uses  {$IFDEF UNIX}  cthreads,  {$ENDIF}  {$IFDEF HASAMIGA}  athreads,  {$ENDIF}  Interfaces, // this includes the LCL widgetset  Forms, unit1  { you can add units after this }; {$R *.res} begin  RequireDerivedFormResource:=True;  Application.Scaled:=True;  Application.Initialize;  Application.CreateForm(TForm1, Form1);  Application.CreateForm(TInputBoxForm, InputBoxForm);  Application.Run;end.  
then I had the next errors as they are shown in next image:

You need to add that unit into your project by using Project Inspector. See my previous post.


--- Quote from: Handoko on July 04, 2022, 07:14:19 pm ---You need to add that unit into your project by using Project Inspector. See my previous post.

--- End quote ---

I was searching for "Project Manager" ... oops!

I noticed now you mean it by " Project Inspector".


[0] Message Index

[#] Next page

Go to full version