Difference between revisions of "TForm"

From Lazarus wiki
Jump to navigationJump to search
Line 1: Line 1:
 
{{TForm}}
 
{{TForm}}
  
'''TForm''' is the class of a form object. All forms created at design time can be derived from TForm.
+
'''TForm''' is the [[Class|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. [[TButton|buttons]], [[TLabel|labels]], [[TEdit|edit fields]], [[TImage|images]]...) can be inserted.
 
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. [[TButton|buttons]], [[TLabel|labels]], [[TEdit|edit fields]], [[TImage|images]]...) can be inserted.
Line 9: Line 9:
 
== Application ==
 
== Application ==
 
At program start, the main form and any other form that has to be 'autocreated' is actually instantiated.
 
At program start, the main form and any other form that has to be 'autocreated' is actually instantiated.
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 <tt>Application.CreateForm</tt> for that form.
+
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|program]]'s [[Uses|uses]] clause and add a line <tt>Application.CreateForm</tt> for that form.
  
 
<syntaxhighlight>
 
<syntaxhighlight>
Line 30: Line 30:
  
 
== Properties ==
 
== Properties ==
* Menu - link a [[TMainMenu]] connected to the form, and visible during run time at the top of the form
+
* Menu - link a [[TMainMenu]] connected to the form, and visible during [[runtime]] at the top of the form
 
* Popupmenu - link to a [[TPopupMenu]] that will be activated when right-clicking on the form
 
* Popupmenu - link to a [[TPopupMenu]] that will be activated when right-clicking on the form
 
* PopupParent -  
 
* PopupParent -  

Revision as of 10:18, 5 January 2019

Deutsch (de) English (en) suomi (fi) français (fr) 日本語 (ja) русский (ru) 中文(中国大陆)‎ (zh_CN)

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

At program start, the main form and any other form that has to be 'autocreated' is actually instantiated. 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.

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

  • Menu - link a TMainMenu connected to the form, and visible during runtime at the top of the form
  • Popupmenu - link to a TPopupMenu that will be activated when right-clicking on the form
  • PopupParent -
  • SessionProperties -
  • ActiveControl -

See also