Sign in Join
Wiki copytemporary

RequireDerivedFormResource: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: RequireDerivedFormResource

OldNewLine
1+**RequireDerivedFormResource** is a switch to toggle the requirement for a [[TForm]]'s resource
2+
3+Each form created by the IDE should have a resource, so if resource is not found there is something wrong with either a resource or the unit which contains the faulty form. Therefore the application should inform the developer that the form can't function correctly without the resource. This change is also Delphi compatible and compatible with [[TFrame]] and [[TDataModule]] components.
4+
5+If you need a resourceless form you have 3 options:
6+
7+- Create a TForm class (not a descendant)
8+- Construct your form using the `CreateNew()` [[Constructor|constructor]].
9+- Disable the exception by setting the global variable RequireDerivedFormResource to False.
10+
11+RequireDerivedFormResource is automatically inserted on creating a new form in the [[IDE]].
12+
13+``` pascal
14+begin
15+ RequireDerivedFormResource:=True;
16+ Application.Scaled:=True;
17+ Application.Initialize;
18+ Application.CreateForm(TForm1, Form1);
19+ Application.Run;
20+end.
21+```
22+
23+---
24+*From the Free Pascal wiki, page "RequireDerivedFormResource", as it stood on 2021-08-28 after a change by Arent, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
25+Category: Forms

Back to history