[Lazarus] How to convert Delphi program with TRichEdit?

Bo Berglund bo.berglund at gmail.com
Wed Dec 8 23:52:07 CET 2021

On Wed, 8 Dec 2021 23:28:23 +0200, "R.Smith via lazarus"
<lazarus at lists.lazarus-ide.org> wrote:

>> So How can I:
>> 1) Replace the main form of a Lazarus program with another form?
>> or
>> 2) Create a new program in Lazarus where I can specify an existing form as the
>> main program form.
>> Either of these will work, but I don't really know how to do any of them.
>This is quick to do -
>via the GUI:
>In the Project Options, simply go to "Forms" and make sure the topmost 
>one is the one you want to load as your main form.

Wel, my form is not shown here either as active or available.
I added the unit via Project Inspector using the Add button...

>via Code:
>Open the program file (Project --> View Source) and make sure in the 
>code section the very first "Application.CreateForm(...)" that appears 
>is the one for your desired main form.

In the source I had to:
- Add the form unit to the uses clause and remove Unit1
- Change the Application.CreateForm call to use the specific form
- Erase Form1 from the lpr file
- Remove Unit1 in Project Inspector.

>Basically TApplication regards the first form it opens as the "main" 
>form, which simply means that that form is shown automatically first 
>(unless specified not to) and that it will exit when that form closes 
>(and a few more small things).

OK, so now I have to solve the dependencies that popped up regarding used units
in the now main form...

Bo Berglund
Developer in Sweden

More information about the lazarus mailing list