Difference between revisions of "TApplication"

From Lazarus wiki
Line 20: Line 20:
  
 
{| class="wikitable"
 
{| class="wikitable"
 +
|+ Properties
 
! Property || type || Writable || Description
 
! Property || type || Writable || Description
 
|-
 
|-
Line 52: Line 53:
 
| SingleInstance || TBaseSingleInstance || -|| Single instance used to control single application instance behaviour
 
| SingleInstance || TBaseSingleInstance || -|| Single instance used to control single application instance behaviour
 
|-
 
|-
| SingleInstanceClass: TBaseSingleInstanceClass; [rw] Class to use when creating single instance
+
| SingleInstanceClass || TBaseSingleInstanceClass || rw || Class to use when creating single instance
 
|-
 
|-
| SingleInstanceEnabled: Boolean; [rw] Enable single application instance control.
+
| SingleInstanceEnabled || Boolean || rw || Enable single application instance control.
 
|}
 
|}
  
 
+
{| class="wikitable"
OnException: TExceptionEvent; [rw] Exception handling event
+
|+ Events
 +
! Event || type || Writable || Description
 +
|-
 +
| OnException || TExceptionEvent || rw || Exception handling event
 +
|}
  
 
==see also==
 
==see also==
 
* [[TCustomApplication]]
 
* [[TCustomApplication]]
 
* [https://lazarus-ccr.sourceforge.io/docs/lcl/forms/tapplication.html TApplication at lazarus-ccr]
 
* [https://lazarus-ccr.sourceforge.io/docs/lcl/forms/tapplication.html TApplication at lazarus-ccr]

Revision as of 17:30, 19 November 2020

TApplication (with instance Application) that is available in every Lazarus program.

Unlike forms, and components on the forms a (single) instance of TApplication is created before any user line of code. In a .lpr file (a pascal file containing the keyword 'program' ) the Application-variable is used to create the applications form(s):

program pMyTest;
uses
  Forms, uMyForm

{$R *.res}

begin
  Application.Initialize();
  Application.CreateForm( TMyForm, MyForm );
  Application.Run();
end.

TMyForm is assumed a descendant of TForm and defined in uMyForm.pas

Properties
Property type Writable Description
ExeName string - Name of the executable.
HelpFile string rw Location of the application help file.
Terminated Boolean - Was Terminate called or not
Title string rw Application title
ConsoleApplication Boolean - Is the application a console application or not
Location string - Application location
Params[] string - Command-line parameters
ParamCount Integer - Number of command-line parameters
EnvironmentVariable[] string - Environment variable access
OptionChar Char rw Command-line switch character
CaseSensitiveOptions Boolean rw Are options interpreted case sensitive or not
StopOnException Boolean rw Should the program loop stop on an exception
ExceptionExitCode LongInt rw ExitCode to use then terminating the program due to an exception
EventLogFilter TEventLogTypes rw Event to filter events, before they are sent to the system log
SingleInstance TBaseSingleInstance - Single instance used to control single application instance behaviour
SingleInstanceClass TBaseSingleInstanceClass rw Class to use when creating single instance
SingleInstanceEnabled Boolean rw Enable single application instance control.
Events
Event type Writable Description
OnException TExceptionEvent rw Exception handling event

see also