Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it safe to remove the declaration of a form from the unit?

When designing a TForm, a line is added to the form's unit declaring the form object...

var
  frmMyForm: TfrmMyForm;

I don't need this form auto-created, and I intend to create multiple instances of it, and to make sure I don't make the mistake of using this declared form, I commented it out...

//var
  //frmMyForm: TfrmMyForm;

I was wondering if this is safe to do? I don't see any problems, and the form designer still works fine. But could there be some trouble if I leave this out completely?

like image 626
Jerry Dodge Avatar asked Sep 02 '12 20:09

Jerry Dodge


1 Answers

This is a very common scenario when using form inheritance. You normally don't want to instantiate derived forms from the middle of the inheritance chain.

The only place where these form variables are used (besides your code perhaps) is the dpr file and that only when the form is autocreated.

So, no problem to remove the declaration.

like image 186
Uwe Raabe Avatar answered Oct 04 '22 20:10

Uwe Raabe