VCL

Documenting your Delphi REST API the easy way

Create documentation is boring. At least that’s my opinion, and most developers I know also don’t like to write it. But that’s something we need to do, of course. Thus, the easiest it gets to document things, the better. Photo by Aaron Burden on Unsplash With TMS XData, you create your REST API server using Delphi very easily, but you also get it documented almost automatically using the automatic Swagger generation feature. Since all endpoints are strong typed in server, all it takes is just to enable a single property and have your endpoints listed and testable. This feature has been available for years already. But now XData takes it to another level. A good (if not the best) way to document your source code is to use XML Documentation Comments. In the interfaces and methods that build your service contract, you can simply add specific XML tags and content, like this: /// /// Retrieves the sine (sin) of an angle /// /// /// Returns the Sine (Sin) value of an angle radians value. /// The value returned will be between -1 and 1. /// If the angle is zero, the returned value will be zero. /// /// /// The angle in radians. /// function Sin(Angle: Double): Double; And Delphi IDE will automatically use it for Help Insight , showing you information about the method on-the-fly. For example, if some developer is trying to use the Sin method of your API, information will be conveniently displayed: The good news is that, with XData, you can use such XML comments in the Swagger document and Swagger-UI that are generated automatically by XData, improving even more your REST API documentation. Since the API endpoints are generated directly from the interfaced and methods, XData knows exactly the meaning of each documentation and can map it accordingly to Swagger. By asking Delphi to generate the XML documentation files, and using a single line of code like this: uses {…}, XData.Aurelius.ModelBuilder; … TXDataModelBuilder.LoadXmlDoc(XDataServer.Model); XData will reuse the documentation and include it in Swagger: Using different documentation for Help Insight and Swagger Reusing the same XML comments is nice as you don’t repeat yourself. Document your code just once, and the same documentation is used for documenting your Delphi interfaces (Delphi developments) and your REST API (API consumer development). But, if for some reason you want to use different documentation content for Delphi developers and for REST API users, that’s also possible. For example, suppose the following documentation: Note that tags summary and param are the regular XML documentation tags. They will be used for Help Insight: And swagger tags with no name attribute (A), or name param-A (B), param-B (C) and remarks (D) will be used exclusively for Swagger documentation: Customizing tags You can also customize the tags in Swagger. Endpoints are grouped together inside a tag, which can have a name and description. By default, the name of the tag will be path segment of the interface service. But you can change it using either swagger tag using tag-name attribute. The description of the tag by default is empty, but you can define it using the regular summary tag, or optionally using the swagger tag with tag-description attribute. Consider the following documentation for both IArithmenticService and ITrigonometryService : The above tags will generate the […]

Read More

TMS FNC UI Pack v3.2 Revealing some highly anticipated components

We already have an extensive set of powerful and feature-rich UI controls in our TMS FNC UI Pack. But there is always room for some additional tools to help you with your cross framework and cross platform work. In this new release of our TMS FNC UI Pack we’ve added 5 new components which were requested by you, our community of great developers who see the enormous advantages of components that can be used on VCL, TMS Web Core, FMX and Lazarus with just one code base. TMS FNC Controls can be simultaneously used on these frameworks: TMS FNC Controls can be simultaneously used on these operating systems/browsers: TMS FNC Controls can be simultaneously used on these IDE’s: New to the TMS FNC UI family TTMSFNCRichEditorHorizontalRuler TTMSFNCRichEditor has a ruler control that can be connected to it. This control has the intuitive handling that you are familiar with from the advanced text editors. With this ruler you can easily control the margins of your page and the indentation of your text. And you have the ability to add tabs, which sets the position of your text when the next tab is pressed. This component is a great advantage to get your text document to a higher level as it helps you with the layout of your text. TTMSFNCSplitter Our TTMSFNCSplitter has the same behavior as other splitters, but as this is a FNC control, you can use the same component on all the different platforms. No more need to set framework specific properties. Next to this timesaving feature, we have made the appearance customizable to your preferences, so the control can blend in with your application. TTMSFNCProgressBar One of the most requested components is the TTMSFNCProgressBar, this provides users with visual feedback about the progress of a procedure within an application. With more than 25 properties to set the appearance and layout of the component, you have a huge range of possibilities to customize your TTMSFNCProgressBar. And by changing the minimum and maximum value, you can easily invert the direction of the progress. TTMSFNCRating While we were creating the TTMSFNCProgressBar, we noticed that it might be nice to have a similar control with interaction. Therefor we created TTMSFNCRating. With the use of images (SVGs as well) you can set a scale to give a rating. If you clear the images, the control will look like a TTMSFNCProgressBar but with the ability to interact with it. This can be done by clicking on the value that you want, sliding from the end of the progress to where you want or via your keyboard with the arrow keys. TTMSFNCWaitingIndicator An indicator for illustrating an indefinite waiting time for a task that is in progress. You can choose if you want show a progress or if you want circles, squares or images moving around a center bitmap or if you want them to change size. In case you want to show that a form or a panel is currently not available, you can center the waiting indicator over the parent and use an overlay to emphasize this. If you want to see some other examples or the behavior of the FNC splitter and rating control, you can have a look at the following video:

Read More

From Windows Certificate Store to TMS Cryptography Pack TX509Certificate component.

TX509Certificate is a component of TMS Cryptography Pack to use X509 certificates. With it, we can sign certificate signing request (CSR) or use it in XAdES, CAdES or PAdES to sign or verify documents. We can generate self-signed certificates, import them from PEM file, from PEM string, from PFX file. In this post, I will explain how to import certificate from Windows Certificate Store. To do that, we have to use the crypt32 DLL and CertOpenSystemStore and CertFindCertificateInStore. CertOpenSystemStore function CertOpenSystemStore(hProv: HCRYPTPROV; szSubsystemProtocol: LPCTSTR) : hCertStore; This function is used to open the certificate store. The microsoft documentation is here. The first parameter hProv is not used and should be set to NULL. The second parameter is a string that names a system store. Most common options are: You can use CertEnumSystemStore function to list the names of existing system stores. The function returns an handle to the store. CertFindCertificateInStore function CertFindCertificateInStore(hCertStore: hCertStore; dwCertEncodingType, dwFindFlags, dwFindType: DWORD; pvFindPara: Pointer; pPrevCertContext: PCCERT_CONTEXT): PCCERT_CONTEXT; The function finds a certificate in a given store. The Microsoft documentation is here. The first parameter is the handle of the store, returned by CertOpenSystemStore. The second parameter is the encoding type of the cert. The options are: X509_ASN_ENCODING PKCS_7_ASN_ENCODING We will use only X509_ASN_ENCODING because it is the certificate encoding type. The third parameter is used with some dwFindType values to modify the search criteria. For most dwFindType values, dwFindFlags is not used and should be set to zero. The fourth parameter specifies the type of search being made. For the complete list of options, you can read the documentation. We will use in this example the CERT_FIND_SUBJECT_NAME option, to search from subject name of the certificate. The fifth parameter contains the content of the search. In your example, it will contain the subject name of the certificate we want. The sixth parameter is a pointer to the last CERT_CONTEXT structure returned by this function. This parameter must be NULL on the first call of the function. To find successive certificates meeting the search criteria, set pPrevCertContext to the pointer returned by the previous call to the function. If the function succeeds, the function returns a pointer to a read-only CERT_CONTEXT structure. A CERT_CONTEXT structure is: _CERT_CONTEXT = record dwCertEncodingType: DWORD; pbCertEncoded: LPBYTE; cbCertEncoded: DWORD; pCertInfo: PCERT_INFO; hCertStore: hCertStore; end; dwCertEncodingType is the encoding type of the certificate, pbCertEncoded is the content of the certificate, cbCertEncoded is the length of the certificate, pCertInfo is the certificate information and hCertStore is the store. Code The code to import a TX509Certificate from the Windows Certificate Store is the following: unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, CryptBase, X509Obj, MiscObj; const X509_ASN_ENCODING = $00000001; CERT_FIND_SUBJECT_STR = 8 shl 16 or 7; // values taken from System.Net.HttpClient.Win type HCRYPTPROV = ULONG_PTR; _CERT_CONTEXT = record dwCertEncodingType: DWORD; pbCertEncoded: LPBYTE; cbCertEncoded: DWORD; pCertInfo: PCERT_INFO; hCertStore: hCertStore; end; PCERT_CONTEXT = ^_CERT_CONTEXT; PCCERT_CONTECT = PCERT_CONTEXT; function ExtractCertWindowsStore(subjectName: string): TX509Certificate; function CertOpenSystemStore(hProv: HCRYPTPROV; szSubsystemProtocol: LPCTSTR) : hCertStore; stdcall; external ‘crypt32.dll’ name ‘CertOpenSystemStoreW’; function CertFindCertificateInStore(hCertStore: hCertStore; dwCertEncodingType, dwFindFlags, dwFindType: DWORD; pvFindPara: Pointer; pPrevCertContext: PCCERT_CONTEXT): PCCERT_CONTEXT; stdcall; external ‘crypt32.dll’ name ‘CertFindCertificateInStore’; implementation {$R *.dfm} function ExtractCertWindowsStore(subjectName: string): TX509Certificate; var Store: hCertStore; Cert: PCCERT_CONTEXT; s: string; i: integer; Conv: TConvert; X509Cert: TX509Certificate; begin Cert := nil; Store := CertOpenSystemStore(0, PChar(‘MY’)); if […]

Read More

Celebrating 20 days the 20 year company anniversary!

It’s a special year for our team as we celebrate the company’s 20th birthday this month. We’ve come a long way over the years, so we wanted to celebrate this together with YOU! Officially on October 17, 2000 the company tmssoftware.com bvba was registered in Belgium. tmssoftware.com bvba ws founded by Bruno Fierens to prepare his operations for the next steps and next level. Since the very beginning of Delphi in 1995, Bruno Fierens was operating as self-employed consultant developing and offering VCL components on the market. On October 17, we plan to look back a bit more in detail on the history of the company but from today we start the 20 days action to celebrate our 20 year anniversary! 20% longer updates and support with licenses in the next 20 days Yes, you hear that correct. For every license purchased (new license, upgrade, renewal) you receive 20% EXTRA time of free updates and free support coming with the product. So, products that come with free 1 year of updates and support, you now receive 20% more, or 438 days instead of 365 days (1 year). This action runs for 20 days, from October 8 to October 28. It is offered to anyone, also loyal existing customers can purchase a renewal and will get an extra 20% renewal time. Also if you have licenses that are not yet expired, you can now already purchase a renewal and these 438 days will be added to your remaining free update & support period. Your opportunity to get one of a limited edition run of 20 pieces of the book “Delphi Hands-on with TMS FNC Maps” For our 20th anniversary we are producing a hyper limited run of 20 pieces only of a full color version of the “Delphi Hands-on with TMS FNC Maps” book. This book will have a special preface with a retrospective of the company written by Bruno Fierens and will be hand signed by the Belgian team. To get a chance to win one of these limited edition books, share an anecdote about the TMS team, the TMS products, TMS events or share a screenshot of your product, your favorite blog article… in the comments section under this blog or on our social media and win the brand new and limited edition TMS FNC Maps hands-on book in color! Twitter: Tag @TMSsoftwareNews & use following hashtags: #tmssoftware , #delphi and #embarcadero Facebook: Tag @tmssoftware & use following hashtags: #tmssoftware , #delphi and #embarcadero YouTube: Tag @tmssoftwareTV & use following hashtags: #tmssoftware , #delphi and #embarcadero Our team will choose from the most extraordinary or special anecdotes/comments found on this blog comment section or on our social media channels and give send the limited edition of the book to your home. Celebrate TMS components with us this October. We are proud of our big TMS family all around the world. Thank you for the many years of trust. Looking forward to the next 20 years!

Read More

Celebrating our 20th anniversary!

As you may already know, this October we are celebrating our company’s 20th birthday! And of course we want you to celebrate with us. In addition to the current ongoing action of winning a limited edition “TMS FNC Maps hands-on” book, we have another special promotion for you! Get 30% discount on online courses at landgraf.dev This promotion runs until November 15, 2020. Available courses TMS Business Masterclass: Delphi developers looking to learn more about ORM, REST/JSON development, multi-tier applications and also some background about TMS Business tools, with code examples.Introduction to TMS WEB Core: Developers looking to build WEB applications using Delphi, following modern Single-Page-Application architecture. What is the language spoken in the course? In all videos of this training course you have the options to turn on subtitles, and they were not auto-translated. All subtitles were written manually to make sense and with technical terms spelled correctly. Full source code for examples Each lecture of this course that uses a sample project has an associated downloadable file which includes the full source code of the example. Your Instructor Wagner is founder of landgraf.dev, a place for Delphi developers to find information and courses about Delphi. Even though being a Master of Science in Engineering, he’s a developer at heart. Having worked with Delphi since its very first version in 1995, and being partner of TMS Software (a renowned company that provides solutions for Delphi), Wagner is the main developer behind popular Delphi frameworks like TMS Aurelius, TMS XData and TMS Scripter, among others. Take advantage of this special discount and be one of the first to secure your place in these online course with Wagner Landgraf at landgraf.dev.

Read More

Today Oct 17, tmssoftware.com BV celebrates its 20 year anniversary

Company foundation On October 17 in the year 2000, the company “tmssoftware.com bvba” was officially founded in Belgium. So, this year 2020, we celebrate on October 17 the 20-year anniversary of the company. After I started developing VCL components in 1995 with the release of Borland Delphi 1, I did this for the first 5 years as first part-time self-employed consultant and later full-time self-employed under the umbrella of “TMS software”. By the year 2000, it became clear that the next step in this process of growth was to found a company, have a separate office, and prepare to hire the first employee. Official declaration of the creation of the company in the Belgian register First steps As Delphi was born and brought Pascal developers RAD component-based development, I quickly realized there was a huge potential in creating components myself to enable me to reuse interesting code among various consulting projects I was doing for companies. I realized that when these components would be of interest to myself, these could probably also have value for other Delphi developers. Fortunately, at that time, there were two websites (Delphi Super Pages and Torry.net) that allowed Delphi developers to share created components with other developers. I was curious to try this out and the very first component released on Torry and Delphi Super Pages was TANIIcon. This was a functionality I had not seen before from other Delphi developers and the component showed on screen animated cursors. I decided to create this component especially because I had not seen it done before and also because it introduced the challenge to create a component with custom property streaming as well as the creation of a custom property editor to pick and preview the animated cursor at design-time. It was a great experience to learn about the internals of the VCL framework. Meanwhile, for my own internal use in consulting projects, I had been working on a component descending from TStringGrid to add loads and loads of features I was needing over and over again in projects. This became TAdvStringGrid and was the first big component I released in a Shareware version. It was released on Delphi Super Pages and Torry and by 1996, I realized we needed a website. In Belgium, these were the early days of the Internet and it was through the ISP that we could get a limited free space for basic HTML pages. It could be found at http://users.skynet.be/tmssoftware. But of course, it no longer exists now. It was only from 1998 that the domain tmssoftware.com was purchased and all pages were moved to a shared hosted server for this domain. Between 1996 and 1998, it was still non-trivial to handle online payment transactions. It was common for developers to send a payment by cheque to purchase shareware. Fortunately, in 1998, Element5 AG in Germany offered its ShareIt service providing a platform for software developers to handle online payments and I almost immediately jumped on it. Fast-forward to the year 2000, the amount of work involved with developing, marketing, selling, supporting VCL components had grown into a more than full-time job. So, it was time to structure this into the company “tmssoftware.com bvba” and move to newer and bigger office spaces. And it is this 20-year anniversary we celebrate today. […]

Read More

Microsoft Edge WebView2 general availability!

Intro Microsoft has recently announced general availability of the WebView2 embedded browser control, part of Microsoft Edge Chromium. https://blogs.windows.com/msedgedev/2020/10/19/edge-webview2-general-availability/. In this blog post, I want to summarize the steps you can take, to configure your or your customer’s environment, and making sure browser components that target the Microsoft Edge Chromium embedded WebView2 interfaces are properly initialized. Microsoft Edge Chromium support is included in TMS FNC Core (TTMSFNCWebBrowser) & TMS VCL UI Pack (TAdvWebBrowser). Using one of those components requires you to follow 2 steps to get the browser up & running on your system. 1) Make sure Microsoft Edge Chromium is available on your system When using one of the above components you need to make sure that Microsoft Edge Chromium is available on your system. There are 3 ways to make either TAdvWebBrowser or TTMSFNCWebBrowser pick up edge. 2) Copy the necessary DLLs to communicate with WebView2 embedded browser control The second step is copying both WebView2Loader_x86.dll & WebView2Loader_x64.dll in to the system32 & sysWow64 folders. Both DLLs can be found in the installation folder, in a sub folder “Edge Support”. After copying both DLLs, to target 32 & 64 bit Windows applications, start the IDE (RAD Studio, or Lazarus), and drop an instance of TAdvWebBrowser or TTMSFNCWebBrowser. The message you will see that indicates the browser is properly initialized is displayed in the screenshot below. Depending on the chosen technique to install Microsoft Edge Chromium, or making sure Microsoft Edge Chromium is available on your system can slightly differ. Deploying your application to your customer When developing your application that uses a TAdvWebBrowser or TTMSFNCWebBrowser, you want to make sure it runs on the customer’s machine. When the customer has Windows updates turned on, Microsoft Edge Chromium should be available on his system. The implementation of TAdvWebBrowser or TTMSFNCWebBrowser checks if this is true, and automatically makes a copy to work with. So no additional steps are required there. Note that this process might take some time when the browser is dropped on the form for the first time, or your application is running for the first time. Each time an update is pushed from Windows updates, a new copy is made to a temporary folder. If you do not want this and you want your application initialization faster you can separately download and install the WebView2 Evergreen runtime (https://developer.microsoft.com/en-us/microsoft-edge/webview2/) on the customer’s machine. This will ensure a proper installation of Microsoft Edge Chromium ready to be used for an embedded browser control. Installing DEV, BETA or CANARY is not recommended when deploying your application. These insider builds are only for development purposes. More info about the application distribution is explained here: https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution

Read More

TMS FNC Maps Team Effort (v1.2)

Team Effort Since the first release we have been working hard and only 4 months after the release, we pushed out an update (v1.1) for TMS FNC Maps with loads of exciting stuff. Now, we are here with another update (v1.2), that brings even more exciting features and a new service. Introducing Apple MapKit JS service TTMSFNCOpenLayers with the ability to configure a custom tile server TTMSFNCMapBox & TTMSFNCTomTom with a property to control the map style Anchoring & Z-Index support in TTMSFNCGoogleMaps TTMSFNCElevation: A new non-visual component to retrieve elevation data based on coordinate Greatly Improved performance loading & parsing GPX files Faster loading of markers & poly elements Getting elevation data from GPX files Bringing all of the above together in a significant update requires a lot of hard work and team effort. TMS FNC Maps v1.2 is a result of a collaboration between various people within the TMS family: Bart Holvoet: Extensive API knowledge and master in REST services, implementation Gjalt Vanhouwaert: Intensive feedback & testing, creating cross-platform demos Holger Flick: Providing feedback & testing, creator of the TMS FNC Maps book Pieter Scheldeman: Architecture & design choices, research on APIs & services, implementation Masiha Zemarai: Marketing campaign, social media & support REST API & mapping services Bringing together multiple mapping services and REST APIs with radically different architecture in one unified cross-platform, cross-framework product was quite a challenge. Thanks to our TMS team effort we succeeded in making this a seamless experience for our customers who can switch services by changing a single property value. – Bart Creating cross-platform demos I joined the TMS FNC Maps task force to create some demos for the customers. My first thought was that it would take days before I could get started with anything useful. But the implementation feels so natural that you can already have a simple application with only 2 lines of code. All of the handling that you want, is implemented in such a way that even for some really cumbersome things, you just need one line of code. You can find a simple example in one of my videos. You can find an online demo here. In just one day I created three different demos for four different platforms. This is the perfect example of the simplicity of working with TMS FNC Maps. And the power of FNC components in general. – Gjalt Edge Chromium TTMSFNCWebBrowser has been updated to offer the support for the latest Edge Chromium stable version. This update will automatically be available when installing TMS FNC Core. More details on how to install Edge Chromium can be found here. TMS FNC Maps Book TMS FNC Maps offers a set of demos and documentation to get you started, but if you really want to energize your developments the TMS FNC Maps Book is a must have!

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