Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-03

MainForm

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Anthony Walter

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?

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

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;

Rather than as it is now:

    if Designer  nil then Designer.PaintGrid else Paint;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150304/fe6926d9/attachment.html>

Reply by email

Mattias Gaertner
to Anthony Walter
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 compatibility.

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?

Show quoted text 6 lines
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;

Done.
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;

Mattias

Reply by email