UniApplication Object

UniApplication returns an instance of TUniGUIApplication which is the owner of all current session resources (MainForm, MainModule, and all other forms and DataModules). It is globally available and can be accessed inside uniGUI control event handlers. UniApplication has several useful properties which can be used to obtain information regarding the associated session — for example, URL parameters, client screen width, client screen height, device type, information related to the client PC, and cookies.

When creating a form in code, its owner must be set to UniApplication:

Example (Delphi)
procedure TMainForm.UniButton2Click(Sender: TObject);
begin
  with TUniForm2.Create(UniApplication) do
    ShowModal();
end;

UniApplication itself is actually a function which returns the correct instance of TUniGUIApplication for the current session:

Unit Declaration
unit uniGUIApplication;

interface

function UniSession: TUniGUISession;

function UniApplication: TUniGUIApplication;

...
circle-exclamation

Example checking platform inside an event handler:

Example (Platform Check)
procedure TMainmForm.UnimButton1Click(Sender: TObject);
begin
  if upAndroid in UniApplication.UniPlatform then
    ShowMessage('This is an Android device!');
end;

Related links:

  • MainForm: https://unigui.com/doc/online_help/main_form.htm

  • MainModule: https://unigui.com/doc/online_help/main_module.htm

  • UniApplication table of contents: https://unigui.com/doc/online_help/index.html?uniapplication-object.htm