From the blog

Quickly And Easily Build A REST Based Notes App With RAD Server In Delphi And C++

EMS.NotesResource Sample is a server-client EMS demo. It requires InterBase to be installed on the machine or to connect to a remote server. Make sure that the server is running before you run the sample. InterBase is used to store the information with the server connections. Use the RAD Server Console to display the statistics. The first part consists of creating an EMS Package with a new ResourceName (Notes). Once you run the package, the resource is registered on the EMS server and can be accessed by a client application using REST. The client needs a TEMSProvider to connect to the EMS Server and to retrieve the JSON data. How to Use the Sample Run the EMS Package When you run the NotesResourcePackage project, the EMSDevServer starts automatically. If the configuration file is missing, a wizard launches. Navigate to the location given above and open: Delphi: NotesResourcePackage.dpk C++: NotesResourcePackageCpp.cbproj Press Shift+Ctrl+F9 or choose Run > Run Without Debugging. The EMS Development Server opens. If it is the first time you are using EMS on the machine, you need to run the configuration wizard in order to create the EMS server configuration file. When the Confirm dialog opens, click Yes. Leave all the parameters by default and go through the different windows by clicking Next. Click Finish to close the wizard. An Information window appears. Click OK. The server starts automatically. Minimize it. Run the Client Application The client expects the EMSDevServer to be running at localhost:8080. If you are running the server at a different address, modify the properties of the TEMSProvider component. The Delphi supported platforms for this sample are: 32-bit, 64-bit Windows, and iOS Simulator. To run the sample on iOS Simulator, change the URLHost property of the TEMSProvider component to the IP address from the machine you are launching the sample and running the server.Note: The TEMSProvider component is placed in the NotesClientModule unit. The C++ Supported platforms for this sample are: 32-bit and 64-bit. On the Project Manager, right-click on ProjectGroup1. Click Add Existing Project…. Navigate to: Delphi: Start | Programs | Embarcadero RAD Studio Sydney | SamplesObject PascalDataBaseEMSNotesResourceNotesClientProject.dproj. C++: Start | Programs | Embarcadero RAD Studio Sydney | SamplesCPPDatabaseEMSNotesResourceNotesClientProjectCpp.cbproj. Press F9 or choose Run > Run. Insert a User name and Password and click Signup, or Login if you previously created an account. Click Add to add a new note. Write the note and click Save. Implementation EMS Package The Resource Module has code to register a REST OverView API resource. The resource is called “Notes”. The resource defines a Get, GetItem, Post, PutItem, and DeleteItem method. Once you run the package and have the EMS server running, as a test, you can invoke the GET method by using the browser http://localhost:8080/Notes.Note: An error message appears informing that you need to be logged in to access this information. The NotesStorageU file defines the path of the notes.ini file where the created notes are saved. Client Application The client application has a TEMSProvider component. This component identifies the address of the RAD Server Engine (EMS Server) (http://localhost:8080). The client application also has a TBackendEndPoint for each method. This component identifies the name of a resource (Notes), the method used, and the ResourceSuffix. The information is managed with TJSONObject and TJSONArray. You can find attached a link below with the original post: http://docwiki.embarcadero.com/CodeExamples/Sydney/en/EMS.NotesResource_Sample

Read More

Take Your Delphi VCL Apps To The Next Level With The Delphi Universal Component Library UWP Controls

Delphi Universal Component Library is the UWP controls for Delphi VCL. With this Delphi Universal Component Library, you can create UWP like programs easily. Delphi UCL gives you the ability to design modern user interfaces within Delphi VCL. The library is free and open-source on GitHub. The main library lies over on this repository, but according to the author of the project, there is a new version of it and the older version is depreciated. There are tens of UWP like controls available to you. Moreover, there is an ability to change the theme of the programs. Some of the features of Delphi UCL: Light and Dark themes Control of the styles Ability to set custom accent colors to controls Support for HighDPI Ability to set the splash screen So if you are looking for a way to change the UI of Delphi VCL apps, this is a solution for you. Head over and check out the full source code and download the Delphi UCL

Read More

Quickly And Easily Add MAPI Support Using Winsoft’s MAPI for Delphi on Windows

Embarcadero Tech Partner WINSOFT provides an easy to use MAPI suite for Delphi. What makes MAPI hard? MAPI is hard. There is lack of clear and consistent coding, different answers provide different solutions, the solution is not in Delphi, there has to be various work-arounds, or the code-snipplet was built for very old non-Unicode version of Delphi. You eventually tear your hair out or get exasperated with partial or non-working solutions. C#, VB.NET users are left out in the cold: if you look around, using MAPI in C# is out of the question as you’ll get all kind of errors as, Extended MAPI is not supported for use with .NET MAPI is supported in native-languages, such as C++ Builder and Delphi. MAPI is an interface for, nearly all email clients on the Windows platform. TheBat – an independent email client, ThunderBird – the FireFox competitor to Outlook, HCL Lotus Notes (formerly IBM, formerly Lotus Notes) and Outlook. MAPI works in both 32-bit and 64-bits, and is installed on Windows 10 as 64-bit MAPI, with 32-bit MAPI compatible DLL. Installation Installation takes less than 1 minute Steps: Go to https://www.winsoft.sk/smapi.htm for the download link Download the trial version Unzip smapi.zip Simple MAPI Demonstration I will send an email with attachment. The code-behind the form, is less than 10 lines: begin with SMapiSendMail do begin SendTo := EditTo.Text; Cc := EditCc.Text; Subject := EditSubject.Text; Body.Assign(MemoBody.Lines); Send; end; ShowMessage(‘Message was sent’); end; begin   with SMapiSendMail do   begin     SendTo := EditTo.Text;     Cc := EditCc.Text;     Subject := EditSubject.Text;     Body.Assign(MemoBody.Lines);     Send;   end;     ShowMessage(‘Message was sent’); end; And successfully sends an email via Outlook: Email Sent The code attaches an email to be sent, with attachment. Outlook Draft Email Make Winsoft’s Simple MAPI Component Suite part of your Delphi arsenal.

Read More

Explore User-Friendly uniGUI Web Framework With Ultra-Modern Components For Delphi/C++Builder

Looking for a Web framework for your Delphi/C++ Builder Applications? How about having a framework which supports both server side and client side with minimal effort to build beautiful web applications ? UniGUI is a Full Stack focused Web Framework which give web development experience to a new dimension for Delphi/C++ builder users. Features : It allows developers to focus on Application business logic rather than working on web application details such as working directly with HTML, CSS, JavaScript, XML Templates and other web Technologies. It offers a separate set of visual controls for Desktop and Mobile applications. Mobile application controls are available in uniGUI Complete Pro Edition. It is based on Sencha Ext JS, one of the industry’s most advanced JavaScript Libraries(uniGUI includes OEM License for Sencha Ext JS). Complete IDE support for creating projects, designing forms, frames , handling data modules. Advanced support for client side Javascript event handlers It offers a Unified GUI which provides a similar user experience over various Hardware and Software platforms. Support all major deployment options( Windows Service and ISAPI Module) How to Create a UniGui Web Application in RAD Studio. File->New->Other->UniGUI for Delphi-> Application Wizard -> Select Project type options to start Standalone/Windows Service/ISAPI. For Mobile Application, File->New->Other->UniGUI for Delphi-> Mobile Application Wizard. Main form : Include uniGui UI components such as UniPopupMenu, UniPanel, UniSplitter,UniStatusBar according to your need. MainModule : Include database connections related components. You can use FireDAC Manager component. ServerModule : TUniServerModule is single class which helps to customize the behavior of your server such as port configuration, SessionTimeout, SSl, AjaxTimeout etc. Event handling can done in both Server side and Client side( Ext Js events) as well. Use mobile visual components for Mobile Applications. To access we need to hit the URL as localhost:8077/m in the browser. Check out the full demonstration in this below Video For Future Roadmap, Latest versions and pricing details check here.

Read More

Build High-Speed Direct Access Apps In Delphi And C++Builder To Most Modern Databases Using FireDAC

FireDAC is a unique set of Universal Data Access Components for developing multi-device database applications for Delphi and C++Builder. With its powerful common architecture, FireDAC enables native high-speed direct access from Delphi to InterBase, SQLite, MySQL, SQL Server, Oracle, PostgreSQL, IBM DB2, SQL Anywhere, Access, Firebird, Informix and more. Large collection of advanced capabilities. Key things to know about FireDAC listed in this post. Configuration Options: Highly configurable, using this you can fine tune your data access and it is important how your Software access with databases. FireDAC provides a wide range of options organized into a hierarchical options system. Most of the options may be left with their default values.The FireDAC options are organized into five groups: FetchOptions – Fetch options that control how the components and Phys layer commands fetch data from a DBMS. For example, it is possible to fetch all records at once or fetch records on demand. FormatOptions – Format options that control how the DBMS data types are mapped to the FireDAC data types and backward. For example, a programmer may set up a mapping for Oracle NUMBER (38) onto dtBCD or onto dtInt64. For more details, read Data Type Mapping. UpdateOptions – Update options that control how FireDAC posts updates to DBMS. For example, during an update, FireDAC can update all fields in a table or only the changed ones. ResourceOptions – Resource options that control how system resources are used, dataset persistence and other. For example, a FireDAC Phys layer command can be performed asynchronously or blocked. TxOptions – Transaction options that control how transactions are performed. For example, perform them in a ReadCommitted isolation mode. Note that TxOptions does not use option value inheritance. SQL Command Preprocessor: The SQL command preprocessor can alter your SQL before sending it to the server When ResourceOptions.EscapeExpand and ResourceOptions.MacroExpand are true. It supports macros substitution and escape sequences.FireDAC supports three types of macro instructions: Substitution variables. A substitution variable starts with the ‘!’ or ‘&’ symbol and is followed by the macro variable name.They allow placing substitution parameters in a command text in order to extend the use of parameters. For example, to parameterize a table name in the FROM clause or the column names in the SELECT clause, you can use substitution variables but not parameters. Escape sequences. They allow writing DBMS-independent SQL commands. Conditional substitutions. They allow expanding the SQL command conditionally, depending on application-defined attributes or on the currently attached DBMS. FireDAC has 4 types of escape sequences: It is enclosed in curly braces ({}). Allowing constant substitution: Allow writing constants in command text, independent of the DBMS syntax and regional settings. Allowing identifier substitution. Alows abstracting from DBMS-specific identifier quoting rules.  Conditional substitution: Allow to substitute text into command, depending on either a DBMS the application is connected to, or on a macro variable value. Beside different syntaxes, these constructions handle parameters and macros in different ways. Scalar functions.Allows abstracting from a DBMS-specific set of a built-in functions and their syntax.  For examples check here Array DML : The Array DML execution technique submits a single DBMS command with an array of parameters. Each command parameter has an array of values, and all parameters have arrays of the same length. Then FireDAC requests the DBMS to execute a command once for each row in arrays. This technique reduces the amount of communication between DBMS […]

Read More

Optimize Database Population Performance With Array DML In Delphi

This sample demonstrates how to use Array DML in FireDAC and compares its performance for different array sizes. Location You can find the ArrayDML sample project at: Start | Programs | Embarcadero RAD Studio Sydney | Samples and then navigate to: Object PascalDatabaseFireDACSamplesComp LayerTFDQueryExecSQLArrayDML Subversion Repository: You can find Delphi code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version. How to Use the Sample Navigate to the location given above and open FireDACArrayDML.dproj. Press F9 or choose Run > Run. Files File in Delphi Contains FireDACArrayDML.dprojFireDACArrayDML.dpr The project itself. fMain.pasfMain.fmx The main form. Implementation Instead of configuring the main components of this sample at design time using the Object Inspector, this sample configures the setup of the TFDConnection and the TFDQuery in run time. When you run the application, you see the following components on the form: A memo object. Two edit objects named DML ArraySize and No of Records. The default value of both objects is 100 and 100000, respectively. A check box object labeled as Use Transactions. It is unchecked by default. Three buttons objects labeled as Run Single Test, Run Array Size Test, and Delete all Rows. Once the sample is running, you can interact with the sample by changing the edit boxes or clicking on the aforementioned buttons: Click on the Run Single Test button to run an Array DML test code using the Execute method in Array DML mode. To this end, the sample takes the length of the DML array from the value of the DML ArraySize edit object. Using the default values of the edit boxes, the sample runs the test for 100000 records using chunks, where each chunk is a DML array of length 100. This mean that for each DML array, the test executes 100 SQL INSERT commands in a single step in order to optimize database population performance. Moreover, as it is done for 100000 records, the sample uses 1000 DML arrays. To implement the test, the sample configures the following: The connection is set to an Oracle demo database.Note: Change the connection parameters according to your environment. For further details, see Database Connectivity (FireDAC). The INSERT command is the following: ‘insert into {id FDQA_Batch_test}(tint, tstring) values(:f1, :f2)’. If you check the Use Transactions check box, the sample uses: The StartTransaction method to start the database transaction before executing the INSERT command. The Commit method to permanently store the modifications made by the INSERT command execution. Click on the Run Array Size Test button to launch a loop that executes nine times the previous test. Each execution uses a different DML array length. The lengths are the following: 1, 2, 5, 10, 50,100, 500, 1000, 5000 and 10000. Click on the Delete all Rows button to delete all the records from the test table. To this end, the sample uses the ExecSQL method with the following DELETE command: ‘delete from {id FDQA_Batch_test}’. For more detailed information and external links to other articles, please follow the link below: http://docwiki.embarcadero.com/CodeExamples/Sydney/en/FireDAC.TFDQuery.ArrayDML_Sample

Read More

Learn How To Easily Customize The Appearance Of A ListView In This Delphi Sample App

Some of the use case needs to view the Multi Details Appearance for a List item in a ListView .e.g Selecting Multiple items Add or Delete from a List with Multi Detail information. Delphi/C++ Builder offers robust components to do the job at design time or runtime with less code and made developer life easy. ListViewMultiDetailAppearance Sample  show three detail text items. It does this by using list view item appearances previously defined in a custom package. You can find Delphi and C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version. Components used in ListViewMultiDetailAppearance App: TListView: FireMonkey component that you can use to hold and present various types of items. The ItemAppearance property value set to MultiDetailItem. TBindingsList: Built on the TCustomBindingsList component and publishes additional properties that can be accessed from within the Object Inspector. Add a new binding and select TLinkFillControlToField under Quick Bindings. TLinkFillControlToField: Links a control to a field and fills the control with possible values. TPrototypeBindSource: It can be used to generate sample data for the LiveBindings in your project. After you prototype an application, configure the real data source so that you see the new data source fields in the LiveBindings design. Implementation Details : When you run the application, it shows a list view. Each list item shows three different detail fields under their main label. You can tap the ToggleEditMode button to have the list view enter a selection edit mode where you can select several items. The buttons at the bottom, LiveBindings and Fill in Code, let you fill the list view with items defined using LiveBindings or defined at run time, respectively. Before Running this Sample ListViewMultiDetailAppearance need to install the package SampleListViewMultiDetailAppearancePackage.bpl. The package defines three subclasses of Appearances.TPresetItemObjects that implement a custom appearance for list view items. It actually defines a base subclass that is later inherited and extended by the other two subclasses. These subclasses use instances of Appearances.TTextObjectAppearance to implement the three detail fields that each list item shows. The rest of the fields are inherited from Appearances.TPresetItemObjects and customized as necessary. The ListViewMultiDetailAppearance application uses these subclasses in the ItemAppearance.ItemAppearance and ItemAppearance.ItemEditAppearance properties of the list view to use the appearance defined in the installed package. You can tap ToggleEditMode to see how the application keeps the appearance in edit mode.  Check out the full article in the DocWiki about the FMX.ListViewMultiDetailAppearance ListViewMultiDetailAppearance Sample App The LiveBindings button uses TLinkFillControlToField to fill the list view using LiveBindings. The Fill in Code button uses a for loop to fill the list view with items created at run time. Check out the full source code for the ListViewMultiDetailAppearance projects for Delphi and C++Builder over on GitHub.

Read More

Secrets Of FireDAC: Learn How To Use Macros In TFDQuery With This Delphi Sample

The Macros sample shows you how to use the Macros property of TFDQuery in order to parameterize parts of the SQL query. The sample allows you to modify the macro values at run time. Location You can find the Macros sample project at: Start | Programs | Embarcadero RAD Studio Sydney | Samples and then navigate to: Object PascalDatabaseFireDACSamplesComp LayerTFDQueryMacros Subversion Repository: You can find Delphi code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version. How to Use the Sample Navigate to the location given above and open Macros.dproj. Press F9 or choose Run > Run. Click on the Use Connection Definition combo box and select an option. Interact with the sample: Modify the Macros values. Click on the Open Query button. Files File in Delphi Contains Macros.dprojMacros.dpr The project itself. fMacros.pasfMacros.fmx The main form. Implementation Before running the sample, the main components are configured at design time using the Object Inspector as follows: A TFDQuery object named qryMain. This component is used to implement a dataset capable of executing SQL queries. The following setup is needed: Configure the Connection property to specify the FireDAC connection object that is used to connect to a DBMS. Set the SQL property to select !column from !tab where !id !Sign !idValue. It specifies the SQL statement to execute for the query. On run time, when you click on the Open Query button, the Macro values are substituted in the place of their names in the SQL statement. Set up the macros property. The sample sets the five macros used on the SQL statement: COLUMN, TAB, ID, Sign, IDVALUE. Set the MacroCreate property of ResourceOptions to True. A TDataSource object named DataSource1. This component provides an interface between a dataset component and data-aware controls on a form. In this sample, it is used to provide communication between the dataset and the grid where the dataset is displayed. To this end, the DataSet property of DataSource1 is set to qryMain, and the DataSource property of DBGrid1 is set to DataSource1. When you run the application, click on the Use Connection Definition combo box and select an option in order to define a connection. When you select an item of the combo box, the sample enables the Open Query button. Then, if you click on the Open Query button, the sample uses the Open method of qryMain in order to execute the SQL statement. The SQL statement is executed using the Macros values in order to retrieve the corresponding data, which is displayed using a TDBGrid component. Once the DBGrid1 is filled, you can interact with the sample in run time: Modify the Macros values. Choose the corresponding Data Type. Click on the Open Query button Please follow the link below to get more information about the sample: http://docwiki.embarcadero.com/CodeExamples/Sydney/en/FireDAC.TFDQuery.Macros_Sample

Read More

Embarcadero Conference Brazil 2020

O maior evento Delphi do mundo irá acontecer novamente este ano. Mesmo com toda a situação da pandemia do COVID-19, a Embarcadero Conference 2020 irá se realizar no dia 20 de Outubro, em um novo formato, 100% online. Apesar dos participantes perderem algumas coisas que só acontecem em eventos presenciais, com conversas valiosas e trocas de experiências com outros participantes nos intervalos das sessões, haverá benefícios interessantes nesse novo formato: Taxa de inscrição mais acessível; Você pode participar de onde estiver – sem precisar pegar um avião e reservar um hotel; As palestras serão gravadas, assim os participantes não perderão nenhuma delas! Note que todas as palestras devem ser ao vivo. Assim, mesmo que elas sejam gravadas para serem vistas depois, escolhendo a palestra a participar trará os benefícios de poder interagir com o palestrante, fazer perguntas, conversar com os outros participantes, e assim por diante. Assim, aqui estão nossas sugestões para as palestras pra você participar: 9 am – SERVIÇOS NA NUVEM: NÃO COMETA ESTES ERROS! (Wagner Landgraf) Após anos lidando com desenvolvimento de serviços na nuvem, seja criando aplicações ou frameworks dedicados nessa área, o palestrante mostrará os principais conceitos, segredos, dicas e experiências para a construção de serviços na nuvem em Delphi. É um compartilhamento das experiências reais, problemas reais e sucessos reais, focando nas armadilhas e problemas que podem ocorrer ao longo do desenvolvimento e mostrando as soluções e prevenções para tais. 1 pm – SEU PRIMEIRO CRUD COM TMS WEB CORE (Marcos Moreira) Será mostrado como configurar o ambiente, criar sua primeira aplicação, e os aspectos para sua distribuição. 3:40 pm – TMS ACADEMIC – THE TMS SOFTWARE ACADEMIC PROGRAM (Wagner Landgraf) O programa TMS Academic será apresentado – suas motivações, seu futuro e como embarcar neste programa para obter licenças 100% gratuitas e funcionais dos produtos TMS se você for um aluno ou professor! Visite a página oficial da Embarcadero Conference 2020, registre-se e participe! — The biggest Delphi event in the world is coming again this year. Even with all the COVID-19 pandemic situation, Embarcadero Conference 2020 in Brazil will happen on October, 20th, in a new format, 100% online. Even though attendants will lose some things, like the great and valuable in-person conversations, there will be some great benefits with this format: More affordable fee; You can participate from where you are – no need to take a plane and book a hotel; Sessions will be recorded so attendants won’t miss any of them! Note that all sessions are supposed to be live. So even though they will be record, choosing a session to attend will bring you the benefit of interacting live with the speaker, asking questions, chatting with other attendants, and so on. Thus, here is our suggestions for sessions you could attend: 9 am – CLOUD SERVICES: DON’T MAKE THESE MISTAKES! (Wagner Landgraf) After years of dealing with cloud service development, whether creating applications or dedicated frameworks in this area, the speaker will show the main concepts, secrets, tips and experiences for building cloud services with Delphi. He will share real experiences, real problems and real successes, focusing on the pitfalls and problems that can occur throughout development and showing the solutions and preventions for them. 1 pm – YOUR FIRST CRUD WITH TMS WEBCORE (Marcos Moreira) You will […]

Read More

TMS WEB Core tips & tricks : Small sample with lots to learn about its versatility

In this article, we start from a TWebResponsiveGrid and use it to demonstrate various tricks that apply throughout the TMS WEB Core framework but are here in combination with the TWebResponsiveGrid perfect to show. The purpose of the article is to show how well the web HTML/CSS world blends with the Delphi developers components world and this in different & flexible ways. We will show you a couple of techniques to customize TWebResponsiveGrid items and make these interactive. TWebResponsiveGrid intro TWebResponsiveGrid is a responsive grid control. This means that it contains a number of items displayed in a 2D grid layout and this layout, i.e. number of columns will be controlled by the device screen size. This number of columns is determined by the setting TWebResponsiveGrid.Options.ItemMinWidth. This sets the minimum width of items in pixels. So, the grid will automatically show as much columns as allowed to still have this minimum width of items respected. And this also takes the TWebResponsiveGrid.Options.ItemGap in account that specifies the gap between items also in number of pixels. Other than this, there is not much to do. When the TWebResponsiveGrid is resized or displayed on a big or small screen, it will use these settings to automatically render the right number of columns for items. To see this directly live, you can also visit this online demo An item can be displayed in normal state, hover state and selected state. Therefore TWebResponsiveGrid.Options has settings for normal state, selected state and hover state colors. In addition or as alternative to setting colors (and other settings) for items, CSS can be used. TWebResponsiveGrid.Options.ItemClassName is the name of the CSS class that can be assigned to the item (outer HTML element of the item is a DIV). Beyond simple HTML in items The items one can add in a TWebResponsiveGrid are of the type TWebResponsiveGridItem and have a property HTML: string to set the HTML the item should contain and the generic Tag property. When the TWebResponsiveGrid.Options.ItemTemplate is set, this is preset for the item HTML when a new item is added. Note that when loading data from JSON or a dataset, the template can hold specifiers (%SPECIFIER%) and this is merged at runtime with hthe JSON attribute or dataset record field. The purpose of this article though is on programmatically filling the items collection. The initial code to fill the TWebResponsiveGrid as such is: for i := 0 to 20 do begin WebResponsiveGrid1.Items.Add.HTML := ‘Grid item ‘+i.ToString+’OK>/button>’; end; This shows how we have added some text and a button to a responsive grid item. The result is very simple. It does not look nice but the responsive behavior is there. The TWebResponsiveGrid is set to top aligned and when resizing the browser, the items automatically flow in the container. Before diving into making the HTML button react, let’s visually enhance the responsive grid items. We do this with some CSS for the TWebResponsiveGrid as well as the TWebResponsiveGridItem. While we could add the CSS style in the HTML file associated with the form or application (which is probably the best place), we wanted to take the opportunity here to introduce the TWebForm.AddCSS() method that allows to dynamically insert CSS at runtime (or remove it later and replace it). Doing so is simple as demonstrated with this […]

Read More