RAD Studio 10.2.2 includes a RAD Server single site deployment license in Enterprise and Architect editions and adds new FireMonkey Quick Edit support, plus many additional features and benefits as described in What’s New in RAD Studio 10.2.2.
Let’s take a look at how we can use the new FireMonkey Quick Edit support to add a Login Form to use with the RAD Server single site deployment license.
Our developer benefit from using the new FireMonkey Quick Edit support is improved developer productivity. With the new Quick Edit feature, you can perform common actions in the FMX Forms Designer. This functionality matches the VCL Quick Edit feature introduced in Berlin Anniversary Update, which was also enhanced in the 10.2.2 release!
Example:
The wizard creates a default Multi-Device application that looks like this:
Using Object Inspector,change ToolBarLabel = Inventory Control System and change the Text for TabItem1 = Login:
In the Structure pane, Right-Click on the TabItem1, and select the new Quick Edit, and change the Name = tabItemLogin
Click the check mark to save the changes.
Next, on the tabItemLogin Tab, add two labels and two Edit boxes and a Button to be used to enter the Username and Password to authenticate (login) to the RAD Server:
Right-Click on label1, select Quick Edit and change the Name = labelUserName and Text = Username.
Click the check mark to save the changes.
Do the same for label2, and change the Name = labelPassword and Text = Password.
Click the check mark to save the changes.
Next, Right-click Edit1, select Quick Edit, and change Name = EditUsername:
Click the check mark to save the change.
Do the same for Edit2, Right-click Edit2, select Quick Edit, and change Name = editPassword.
Click the checkmark to save the change.
Since this Edit field is a password, use the Object Inspector, and set the Password property = True:
Next, Right-click the Button, select Quick Edit, change Name = buttonLogin, and Text = Login:
Click the checkmark to save changes.
Our Login tab now looks like this:
On the Login tab, add an EMSProvider component. The EMSProvider sets up the connection to the EMS Server. In an EMS Client application, we use the TEMSProvider to set the connection parameters (URLHost and URLPort) with the EMS Server, like this:
For the EMSProvider, us the Object Inspector and set the URLHost and URLPort of your RAD Server EMS Server:
Next, on the same Login tab, add a TBackEndAuth component. The TBackendAuth has Login and LoggedIn methods we can use to authenticate the Username and Password to the RAD Server.
For the TBackEndAuth component, use the Object Inspector and set the BackEndAuth1.Provider = EMSProvider1.
Next, let’s use Visual Live Bindings to help implement the Login. Right-click on the Login Tab, select Bind Visually… and you will see the BackendAuth, editUsername and editPassword components in the LiveBindings Designer. Bind the BackendAuth1.UserName to the editUsername.Text and bind the BackendAuth1.Password to the editPassword.Text. Like this in the LiveBindings Designer:
Next we can implement the buttonLoginClick event like this:
procedure TTabbedForm.buttonLoginClick(Sender: TObject);
begin
try
BackendAuth1.Login;
If (BackendAuth1.LoggedIn) then
begin
TabControl1.ActiveTab := TabItem2;
end;
Except
on E: Exception do
begin
ShowMessage(‘Invalid UserName/Password or Connection to RAD Server failed’);
end;
end;
end;
We can now test Logging into our RAD SERVER EMS SERVER.
Start you EMSDEVSERVER.EXE.
Run your client TabbedApplication.
On the Login Tab, enter one of your RAD SERVER EMS Server valid Username and Password:
Click the Login button. If the Login succeeds, the app should advance to TabItem2, like this:
If the Login fails, then you should see this:
Congratulations! And that’s how easy it is to add Login Authentication to the RAD Server EMS Server!
And now that the current Delphi 10.2.2, C++ Builder 10.2.2 and/or RAD Studio 10.2.2 includes a RAD Server single site deployment license in Enterprise and Architect editions, you can try yourself to create awesome n-tier architecture or multi-tier architecture applications where your software is engineered to have the processing, data management, and presentation functions physically and logically separated!
[DownloadButton Product=’Delphi’ Caption=’Download and try RAD Studio 10.2.2 Tokyo today!’]
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition