Difference between revisions of "Using the LCL without Lazarus"
Revision as of 12:20, 30 June 2011
How to use the LCL without the Lazarus IDE?
Things you'll need: Free Pascal 2.4.4 Lazarus 0.9.30
Tested on Microsoft Windows XP SP3.
You aren't forced to use the Lazarus IDE if you want to develop with the LCL. You can use it directly from the Free Pascal Compiler.
The installation process
First download the Free Pascal 2.4.4 and the Lazarus 0.9.30 and install them.
Our FPC install directory will be this
"X" is the drive letter
The Lazarus install directory will be this
Then copy the lcl folder.
Copy this folder:
Paste it to this location:
Now you can remove the Lazarus from your computer. In the next section we'll informate the FPC that the LCL's been installed.
Start the FPC. Click on the Options menu and then the Directories menu item. Select the Units tab (default).
Add these directories:
X:\FPC\2.4.4\units\i386-win32\lcl X:\FPC\2.4.4\units\i386-win32\lcl\units\i386-win32 X:\FPC\2.4.4\units\i386-win32\lcl\widgetset X:\FPC\2.4.4\units\i386-win32\lcl\interfaces\win32
Then click on the Include files tab.
Add this directory:
Now, you should be able to use the LCL. In the next section we'll try out creating a form with a button on it.
This is the base-code:
program lcl_base; uses Classes, Interfaces, Forms; //Interfaces is important BEGIN END.
First we'll create a form:
program lcl_base; uses Classes, Interfaces, Forms; //Interfaces is very important type TForm1 = class(TForm) end; //Our Form class var Form1: TForm1; //Declare the Form1 BEGIN Application.Initialize; Applcation.CreateForm(TForm1, Form1); Applcation.Run; //We do exactly the same as the Lazarus does END.
And then we'll create a nice button;
program lcl_base; uses Classes, Interfaces, Forms, StdCntrls; //Interfaces is very important type TForm1 = class(TForm) Button1: TButton; end; //Our Form class var Form1: TForm1; //Declare the Form1 BEGIN Application.Initialize; Applcation.CreateForm(TForm1, Form1); Button1 := TButton.Create(Form1); With Form1.Button1 Do Begin Parent := Form1; Visible := TRUE; Left := 10; Top := 10; Width := 100; Height := 100; Caption := 'PRESS ME'; End; Applcation.Run; //We do exactly the same as the Lazarus does END.
That's it. Now, you are able to use the LCL without the Lazarus IDE.