Delphi

Learn How To Embed C Source Code To Delphi FireMonkey Applications

In this CodeRage session, you can explore how to embed C code into a Delphi FireMonkey project. The demo was demonstrated by Marion Candau. How to compile C code to embed into Delphi project How to link the C objects to the Delphi units How to call C functions To compile C source code you can go with C++ Builder or other tools for instance Visual Studio. We have 2 options for the resulting format, they are object files and shared libraries. You can use object files for Windows 32 and 64 bits, also macOS 32 and 64 bits. And a shared library for Linux, Android, and iOS. How to link the C objects to the Delphi units? We need to link the C object files for Windows and macOS 32 platforms For mobile platforms, we link each function with its shared library file and need to add the path to the shared library into the Search path. To learn more about how to embed C code on different platforms, be sure to watch the full CodeRage session! Head over and watch the Embed C Source Delphi video on YouTube!

Read More

Learn About Quickly Building REST Applications Using The Powerful RAD Server In Delphi/C++ Builder

Over a period of years lot of Web Architectural styles were introduced like, Pipe and filter, Uniform Pipe Filter and some hierarchical styles like client server, Client server stateless, cache, etc. But each style has equal strength and limitations which leads to a modern, scalable, stateless architectural style called REST which is widely adopted. The Word REST is the Abbreviation of the Phase ‘Representational State Transfer’ is the Architectural Design Style introduced in year 2000 presentation by Roy Thomas Fielding one of the Co-founder of HTTP Specification.  Web services that conform to the REST architectural style, called RESTful Web services, provide interoperability between computer systems on the internet. REST is not a standard or Protocol. Its a style of architecting a Application. REST provides a set of architectural constraints that, when applied as a whole, emphasizes scalability of component interactions, generality of interfaces, independent deployment of components, and intermediary components to reduce interaction latency, enforce security, and encapsulate legacy systems. The constraints are, Client-Server: Separation of Concern is the principle behind this constraint. Separating the user interface concerns from the data storage concerns, can improve the portability of the user interface across multiple platforms and improve scalability by simplifying the server components. Also it allows the components evolve independently. Stateless communication: Client Server communication should be stateless in nature. Each request from client to server must contain all of the information necessary to understand the request, and cannot take advantage of any stored context on the server. Session state is therefore kept entirely on the client. This constraint induces the properties of visibility, reliability, and scalability. Uniform Interface: Implementations are decoupled from the services they provide, which encourages independent evolvability. The trade-off, though, is that a uniform interface degrades efficiency, since information is transferred in a standardized form rather than one which is specific to an application’s needs. The CRUD Operations Create, Read, Update, Delete are the key methods which is reused across all types of objects. Layered System: To improve behavior for Internet-scale requirements, layered system constraints is added.  It Allows an architecture to be composed of hierarchical layers by constraining component behavior such that each component cannot “see” beyond the immediate layer with which they are interacting.  REST Elements : The key abstraction of information in REST is a resource.  More precisely, a resource R is a temporally varying membership function MR(t), which for time t maps to a set of entities, or values, which are equivalent. The values in the set may be resource representations and/or resource identifiers. A resource can map to the empty set, which allows references to be made to a concept before any realization of that concept exist. REST uses a resource identifier to identify the particular resource involved in an interaction between components. REST connectors provide a generic interface(CURD) for accessing and manipulating the value set of a resource, regardless of how the membership function is defined or the type of software that is handling the request.  A representation is a sequence of bytes, plus representation metadata to describe those bytes. Other commonly used but less precise names for a representation include: document, file, and HTTP message entity, instance, or variant. Individual resources are identified in requests, for example using URIs in RESTful Web services. The resources themselves are conceptually separate from the representations that are returned to the client. For example, the server could send data from […]

Read More

Learn To Use Styles To Create Visual Stunning VCL And FireMonkey Apps With Delphi/C++ Builder

What is a Style: A set of graphical details that define the look and feel of a VCL application/FireMonkey Application, Similar to a theme in Windows. A style permits you to change the appearance of every part and state of a control. For instance, a scroll bar has the following parts: frame, slider, and the two side buttons for each direction. The side buttons, for example, have the following states: pressed, disabled, hot, normal. How to apply styles for an VCL Application: To set a style for your VCL application, select the style in Project > Options > Application > Appearance. See Application Appearance for more details. Note: The VCL style changes the appearance of the application in run-time. However, the Form Designer does not show this changes. Location of Style Files (.vsf Files): The VCL styles that ship with the product are available in C:UsersPublicDocumentsEmbarcaderoStudio21.0Styles. Use the Vcl.Themes.TStyleManager class to load, register, and select styles or to get, register, and unregister a style engine. FireMonkey: Uses lightweight GUI controls on top of a cross-platform abstraction, which is implemented for Windows and other platforms. Lightweight controls mean that every pixel is drawn by FireMonkey, no native (heavyweight) controls are used.FireMonkey controls are arrangements of a tree composed of sub controls, primitive shapes, and brushes, decorated with effects. These compositions are defined as styles, stored in a style book. The individual elements of a style are internally called resources; because that term has several other meanings, the term style-resource is used for clarity. Styles provide a great deal of customizations without sub classing. The FireMonkey styles that are provided with the product are saved in .Style files located in C:Program Files (x86)EmbarcaderoStudio21.0RediststylesFmx. You can load these styles with FireMonkey Style Designer. FireMonkey Style Designer: The FireMonkey Style Designer window, in combination with the Structure view and the Object Inspector, helps you create, edit, and test FireMonkey styles. To work with Platform styles, in the Form Designer or Structure View, double-click a style book component. To work with Custom styles, use the following commands of the shortcut menu displayed when you right-clicked a styled component: Edit Default Style: Opens a new FireMonkey Style Designer window in which you can modify the style for the component class. For example, if you right-clicked a button, you can modify the “buttonStyle” object (a default style for the TButton class) . Edit Custom Style: Opens a new FireMonkey Style Designer window in which you can modify the selected control style. For example, if you right-clicked a button, you can modify the “button1Style” object (a style for this button only). Bitmap Style Designer for VCL and FireMonkey: The Bitmap Style Designer enables you to: Create, edit, and test FireMonkey styles (.style files) Create, edit, and test VCL styles (.vsf files) Convert a VCL style (.vsf file) into a FireMonkey style by saving the VCL style as a FireMonkey style (.style file) Watch this video to check Windows 10 look and feel for VCL and FMX. Windows 10 Look and Feel for VCL and FMX

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

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

Comprehensive Music Theory and Ear Training App Built In Delphi

With almost 3,000 lessons created by music teachers for beginners to professional musicians playing any instrument, EarMaster is a comprehensive, consumer-grade app with extraordinary functionality that uses a variety of different technologies. Despite the app’s technologically advanced backend, the EarMaster team worked hard make it as simple and intuitive as possible to use. EarMaster features audio recording and audio playback, musical instrument digital interface (MIDI) input and output, instrument sound sampler and many other technologies – all made with the native iOS frameworks (AudioUnit, CoreMidi, etc). It supports Windows and macOS as well as iOS. It draws real-time pitch curves on a musical staff based on pitch detection of microphone recordings, teaching musicians of all levels to recognize, transcribe and sing melodies, scales, chords, intervals, chord progressions and rhythms. Website https://www.earmaster.com/ Press Release https://www.embarcadero.com/press-releases/embarcadero-selects-earmaster-for-august-cool-app-contest Screenshot Gallery “We choose Delphi because it allows us to create a true native iOS app, with a GUI using native components, and still share 97 percent of the source code with other platforms,” Hans Lavdal Jakobsen, managing director and lead developer of EarMaster ApS “If you develop a multi-platform app, Delphi is simply the fastest way to go.” Hans Lavdal Jakobsen, managing director and lead developer of EarMaster ApS

Read More

Learn How To Build MVVM Pattern Based App In 20 Minutes

MVVM is a software architectural pattern that facilitates the separation of the development of the graphical user interface via a markup language or GUI code from the development of the business logic or back-end logic so that the view is not dependent on any specific model platform. In this Skill Sprint in 20 minutes, you can learn how to apply this MVVM pattern to your Delphi applications smoothly.  Model-View-ViewModel The MVVM design pattern decouples your application code and separates the concerns of your application. You must care about MVVM because it is the way to write maintainable, testable code. The compelling reason is the ease of maintenance. Utilize MVVM and, your app will never become a legacy application. How can you achieve within Delphi? The answer is separating the software. ViewModel – Present data to the view View – User interface Model – Business logic or back-end Be sure to watch the whole session to learn more about the MVVM pattern and the demo using the Delphi.

Read More

FL Studio Is A Massively Popular Digital Audio Workstation Software Built In Delphi

Image-Line Software is the Belgian based creator of FL Studio, one of the most popular Digital Audio Workstations (DAWs) available on the market for creating music. FL Studio is installed more than 30,000 times per day (more than 10 million installations a year) by users in more than 200 countries, including power users such as Avicii, Martin Garrix, Afrojack, and Mike Oldfield. “Delphi is very important for us as a development tool because it allows us to do inline assembly and link function to the code directly. With classic development tools, that process is much clumsier. However with Delphi you can just add a button and double click; it speeds up coding and allows us to work in the language we know best.” – Jean-Marie Cannie, CTO and Founder Case Study https://www.embarcadero.com/case-study/image-line-software-case-study Download https://www.image-line.com/ Screenshot Gallery

Read More