[Lazarus] MainForm

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Mar 7 11:35:08 CET 2015

On Wed, 4 Mar 2015 07:03:29 -0500
Anthony Walter <sysrpl at gmail.com> wrote:

> Is there some reason, other than for Delphi compatibility, that the
> MainForm of an application must descend from TForm, rather than allowing
> other TCustomForm derived forms?

There is TForm.CreateWnd.
Otherwise: By design. So, yes, the main reason is Delphi

> I was writing some custom form modules and was surprised that they cannot
> be made at the first form in an application.

Can you use TForm as ancestor?

> Also I thought I submitted a patch for this a year ago, but
> TCustomForm.PaintWindow still prevents a form from doing any painting while
> in design mode. The simple fix is:
>     Paint;
>     if Designer <> nil then Designer.PaintGrid;

This may break existing code, so it is too late for 1.4.

> Rather than as it is now:
>     if Designer <> nil then Designer.PaintGrid else Paint;


More information about the Lazarus mailing list