Sign in Join
Wiki copytemporary

TForm

Deutsch · English · Français · Suomi · Русский · 中文(中国) · 日本語

TForm is the class of a form object. All forms created at design time can be derived from TForm.

The form represents a window or dialog box that forms the user interface of an application. It is the container on which all other components (e.g. buttons, labels, edit fields, images...) can be inserted.

A new TForm can be created using File|new....

Application

Forms created at design time using File|new... or clicking the new Form button, will create a new class or unit. To make one form accessable from another requires the new form to be added to the uses section of the unit for first form. To prevent circular referencing when each form requires to be added to the uses of the other, this will need to be added to a uses section under implementation. At program start, the main form and any other form that has to be 'autocreated' is actually instantiated. The forms are started in the sequence they are listed in the project. Autocreate forms may be selected from available forms in [Project|Project Options|Forms]. If for some reason available forms do not list the form that should be autocreated, add the necessary form name to the program's uses clause and add a line Application.CreateForm for that form.

The project source code PTest.lpr:

pascal
program PTest;
uses
  Forms,
  UMainForm,
  UOtherForm;
{$R *.res}

begin
  Application.Title:='Test';
  RequireDerivedFormResource := True;
  Application.Initialize();
  Application.CreateForm(TMainForm, MainForm);
  Application.CreateForm(TOtherForm, OtherForm);
  Application.Run();
end.

Properties

Events

See also


From the Free Pascal wiki, page "TForm", as it stood on 2022-07-16 after a change by Mario13, 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.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.