DelphiFan Magazine

Top Menu

Main Menu

  • DELPHI
  • CODE SAMPLES
  • FIREMONKEY
  • DATABASE
  • RELEASES
  • VIDEOS
  • REVIEW
  • TECH NEWS

logo

DelphiFan Magazine

  • DELPHI
  • CODE SAMPLES
  • FIREMONKEY
  • DATABASE
  • RELEASES
  • VIDEOS
  • REVIEW
  • TECH NEWS
  • How to add a server application written in UNIGUI to startup?

  • UniGUI Expiry Link Anonymizer

  • UniGUI Add CAPTCHA to the WEB project

  • UniGui. Unique hybrid of Delphi and JS

  • How to transform a blob field into string lines (varchar) in SQL Firebird?

CODE SAMPLESDELPHI
Home›CODE SAMPLES›UniGUI’s forms and modules

UniGUI’s forms and modules

By admin
November 9, 2020
1612
0
Share:

Each uniGUI application is composed of a dedicated main form (MainForm) and two dedicated modules (MainModule) and a service module (ServerModule) and is automatically created. The login form (LoginForm) also has a special meaning in uniGUI. It is mainly used to complete the login transaction of the session user, which can be selected or added as appropriate.

he above mentioned are some of the main or indispensable forms and modules, which do not include the data modules (DataModules), pages (Frames) and forms (Form) created by users themselves according to their needs. The main categories are as follows:

1) Data Modules: Application Data Module, Free Data Module
2) Form (Form): Login Form (LoginForm), Main Form (MainForm), Application Form (Application Form), Free Form (Free Form)
3) Page (Frames)
PS: I will describe the above parts in detail in the relevant learning chapters later. Here is only one outline, so that everyone can understand it in general.

(1) Service module (ServerModule):

Every uniGUI application contains a service module named ServerModule, which is the core module of the application. It is singleton, which means that each application is created only once. It is mainly used to configure various server settings. The design interface is as follows:

(2) Main Module (MainModule):

The main module (MainModule) can be considered as the core of the session. It is a special-purpose module that is automatically created and added to the project every time a new project is created. MainModule has many important roles in uniGUI applications. Some of these roles are not visible to developers. The interface diagram during design is as follows:

For developers, MainModule can be used to place resources shared by the session, such as database connections, shared variables, etc. For example, you can declare public variables in the public section of MainModule and then access them from other forms in the session.

The following example demonstrates the common practice of sharing data between different forms in a session in uniGUI. Since each session has its private copy of MainModule, it will ensure that each form accesses its private data set in its session.

 TUniMainModule = class(TUniGUIMainModule)
  private
     { Private declarations }
  public
     { Public declarations }
     aUserName, aPassword: string;
  end;

You can then access these variables from other forms in the application:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
    UniLabel1.Caption :=UniMainModule.aUserName + ' ' + UniMainModule.aPassword;
end;

(3) Login form (LoginForm):

LoginForm is another special form type, used only for login purposes. If the application contains LoginForm (it inherits from the TUniLoginForm form class), it will generally be the first form displayed when the Web session is started. You can use the uniGUI wizard to create a LoginForm through the following path:

File->New->Other->Delphi->uniGUI for Delphi->Form

The main steps to create a LoginForm with uniGUI wizard are as follows:

This action will create a blank LoginForm, which looks the same as a regular form:

Developers can design the login interface according to their needs and implementation. For example, they can design the following picture (sample):

LoginForm is a descendant of a built-in class called TUniLoginForm. There can only be one LoginForm per application. After adding LoginForm, the application will display this form when a new session starts. You need to add controls, event handlers, and everything you need to achieve the required login functionality. Use the ModalResult of the form to control the login behavior. If LoginForm returns mrOK, it means successful login, and a new MainForm will be created and activated. When ModalResult returns mrCancel, it will terminate the session. If we use a form with only two buttons (one for successful login and the other for failure), please see the code below for details:

/Enter
procedure TUniLoginForm1.UniButton1Click(Sender: TObject);
begin
    ModalResult := mrOK;  // After valid login, it will jump to the MainForm form
end;

//Cancel 
procedure TUniLoginForm1.UniButton2Click(Sender: TObject);
begin
    ModalResult := mrCancel; // Exit the program after invalid login or give up
end;

Once the user logs in and displays the MainForm, there are two ways to terminate the session. You can terminate the session by returning mrOK as ModalResult and return to LoginForm, or terminate the session by returning mrCancel. For security reasons, existing sessions are always terminated before the LoginForm is displayed, that is, each new login starts a new session.

(4), The main form (MainForm):

MainForm is a single form that implements SPA. It is created and displayed after successful login (LoginForm) (if there is no LoginForm, it will be created and displayed directly). Generally, MainForm is the main form of an application that uses menus or other navigation tools to navigate to other forms. The MainForm is automatically created when a new project is created. Each Web session has its own private copy of MainForm, independent of each other, closing MainForm will terminate the current session. The following figure is a blank main form (MainForm):

MainForm is registered in the initialization of the unit so that uniGUI can separate it from other forms. The implementation code is as follows.

initialization
   RegisterAppFormClass(TMainForm); 
end.
Tagsdelphiunigu modulesuniguiunigui appunigui forms
Previous Article

How create a new uniGUI application

Next Article

Use of Unigui fontawesome icon font library

0
Shares
  • 0
  • +
  • 0
  • 0
  • 0
  • 0

admin

Related articles More from author

  • CODE SAMPLESDELPHI

    How to upgrade jquery uniGUI

    October 1, 2020
    By admin
  • CODE SAMPLESDELPHI

    How to add a server application written in UNIGUI to startup?

    January 27, 2021
    By admin
  • CODE SAMPLESDELPHI

    UniGUI Expiry Link Anonymizer

    January 27, 2021
    By admin
  • CODE SAMPLESDELPHI

    How create a new uniGUI application

    November 8, 2020
    By admin
  • DELPHIRELEASES

    Custom High Performance VCL Component Suite For Delphi/C++ Builder By ErrorSoft

    September 29, 2020
    By admin
  • CODE SAMPLESDELPHI

    DBGrid beautification and SQLite display problem

    November 24, 2020
    By admin

Leave a reply Cancel reply

You may interested

  • CODE SAMPLESDELPHI

    Delphi View DPR file

  • CODE SAMPLESDELPHI

    Showing “wait” screen for time-consuming processes

  • CODE SAMPLESDELPHI

    Unigui quickly uses the css style of figma

  • LATEST REVIEWS

  • TOP REVIEWS

Timeline

  • January 27, 2021

    How to add a server application written in UNIGUI to startup?

  • January 27, 2021

    UniGUI Expiry Link Anonymizer

  • January 26, 2021

    UniGUI Add CAPTCHA to the WEB project

  • January 26, 2021

    UniGui. Unique hybrid of Delphi and JS

  • January 13, 2021

    How to transform a blob field into string lines (varchar) in SQL Firebird?

Latest Comments

Find us on Facebook

Follow Us on Instagram

logo

Our website, law, laws, copyright and aims to be respectful of individual rights. Our site, as defined in the law of 5651 serves as a provider of space. According to the law, contrary to the law of site management has no obligation to monitor content. Therefore, our site has adopted the principle of fit and remove. Works are subject to copyright laws and is shared in a manner that violated their legal rights, or professional associations, rights holders who, adsdelphi@gmail.com I can reach us at e-mail address. Complaints considered to be infringing on the examination of the content will be removed from our site.

About us

  • 660 Pennsylvania Avenue Southeast #100 Washington, DC 20003
  • 0123456789
  • adsdelphi@gmail.com
  • Recent

  • Popular

  • Comments

  • How to add a server application written in UNIGUI to startup?

    By admin
    January 27, 2021
  • UniGUI Expiry Link Anonymizer

    By admin
    January 27, 2021
  • UniGUI Add CAPTCHA to the WEB project

    By admin
    January 26, 2021
  • UniGui. Unique hybrid of Delphi and JS

    By admin
    January 26, 2021
  • How to add a server application written in UNIGUI to startup?

    By admin
    January 27, 2021
  • Amazing Cross Platform Email App Sample In Delphi 10.4.1 FireMonkey For Android And IOS

    By admin
    August 13, 2020
  • Critical Update Available For Delphi FireMonkey 10.4.1 On Android, IOS, OSX, Windows, And Linux

    By admin
    September 4, 2020
  • Setting up the IDE for your first Android Application in Delphi

    By admin
    September 7, 2020

Follow us

Find us on Facebook

© Copyright Delphifan Forum. All rights reserved.