[Lazarus] How to convert Delphi program with TRichEdit?

R.Smith ryansmithhe at gmail.com
Wed Dec 8 22:28:23 CET 2021

On 2021/12/08 22:44, Bo Berglund via lazarus wrote:
> I need to port an old Delphi program to FPC/Lazarus and it contains two
> TRichEdit components.
> When I try to open the form in Lazarus 2.0.12 on Windows 10 with Fpc 3.2.0 I get
> an error because the TRichEdit component does not exist....
> Is there some non-standard package I could install (from  OLPM or similar) in
> order to get it working again?

Not really. The problem is TRichEdit was just a wrapper for the MS 
Windows RichEdit component, which was born before the days of HTML 
componenets, so far inferior to anything new. It does not exist anywhere 
else in the world and so not useful on a cross-platform development 
system. Not sure if anybody reverse-engineered the RichEdit 
functionality, but if Google doesn't know then I am relatively sure 
there isn't.

> I have a new laptop now and I have no new Delphi version installed (except for
> Delphi 7 with the no-nonsense license). I am only using Fpc + Lazarus nowadays.
> Another question while I am here:
> ---------------------------------
> The form I have problems with is a special calculation sheet in one single form,
> which is part of the source program.
> But I only need to port this form into the new Lazarus program so I tried to
> create a new program from scratch and intended to replace the default form as
> the main form.
> But I don't know really how to do this...
> 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.

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.

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).

More information about the lazarus mailing list