Delphi

Easily Bridge Your FireMonkey Windows Apps And JavaScript Using ScriptGate

Before knowing how to bridge FireMonkey application and JavaScript using ScriptGate, Let’s understand what is Native App and Hybrid App? What’s the difference between them? How to develop a Hybrid App using Delphi? Is it possible? What’s the challenge? This post will guide you to understand better. Native Apps : A software application built in a programming language, for the specific platform like iOS, Android ,Windows, macOS and Linux. The pros and cons are, The Best performance – no extra calculations or interpretations layers. No way to update UI without updating the app (only if you don’t have some built-in UI update engine) Your app can be used only for target platforms. You cannot start the app inside the browser without using something like Thinfinity Virtual UI. Hybrid Apps: Hybrid apps are part native apps, part web apps. It can take advantage of some device features available. Like web apps, they rely on HTML being rendered in a browser, with the caveat that the browser is embedded within the app. The pros and cons are, Possibility to update the UI and logic without updating the whole app. Great opportunity if you like to use HTML/CSS/Javascript for UI and even for business logic. Not the best performance – your app UI or business logic ( like Javascript) executes inside the browser component. Risk during submission to app stores (but your app still looks like a native app to the play store). Hybrid apps with Delphi is that possible? Yes, using the TWebBrowser component and ScriptGate. Why do we want to use ScriptGate? It looks like a native application, access to platform-specific features, like get device token, working with push notifications (including background mode), access to BLE and other hardware onboard features, working with permissions, and so on. Possibility to publish the application to app stores like a native app. What’s the challenge here?The main challenge – organize communication between your HTML/CSS/JavaScript web application, stored inside the TWebBrowser component, and your Host application code..E.g) Get Push notifications token in the host app and transfer it to the web app. Initiate permission requests from web app before calling some restricted function, e.g perform calls. Register geofences for the platform, e.g get a list of geofences via Rest API from Web Server using javascript code and put them to the OS using host app. ScriptGate solves the above challenges: ScriptGate is a library that allows you to call back and forth between JavaScript and Delphi code on TWebBrowser across Android, iOS, macOS, and Windows. Watch the Video Demonstration on how to bridge the FMX and JavaScript using ScriptGate mentioned below. Check out the other ways to Bridge Your Delphi Application and Javascript here. You can download the ScriptGate library for Delphi over on BitBucket.

Read More

Feel The Lightning Speed Of The Delphi Compiler For Maximum Productivity!

In this demonstration, you can see the speed of Delphi compiler which compiles one million lines of code in 5 seconds! This is epic! This demonstration has done using Delphi 10.1 Berlin version. Since then, we have got big major updates, compiler enhancements, and Delphi language enhancements. Be sure to check out the latest update in this post: 1 Million Lines of Code: 18,000 pages of printed text 14 copies of War and Peace 25 copies of Ulysses 63 copies of Catcher in the Rye Check out this million lines of code visualization Improving Compile Times Library packages – Built-in, 3rd party, and shared libraries are precompiled so they don’t need compilation with each build Precompiled units – Only new compile the units that change since the last compile Divide large projects into multiple smaller packages Inlining compiler optimizations, run time packages, optional debugging, and RTTI Watch the demonstration and feel the speed!

Read More

Powerful Visual Optimizer For Investment Portfolios Built In Delphi

OptiFolio is an advanced interactive portfolio optimization software built in Delphi. According to the developer “OptiFolio can produce an interactive visualization of all possible investment strategies for any given set of financial assets. Delphi’s compiled code extreme execution speed makes it possible to examine millions of strategies per second. This global perspective of feasible portfolios helps investors around the world to identify their best long-term strategies.” Some of it’s portfolio optimization features include: Apply quasi-stochastic and stochastic optimization methods, Find global optimums even with numerous and complex constraints, Report the composition of each point along the efficient frontier, and Save optimum portfolios for further analysis. Additionally, it has performance statistics to Calculate expected return, standard deviation and Conditional Value-at-Risk and Use multivariate copulas to forecast the performance of any portfolio. Website https://www.optifolio.net/ Ready to get started with the latest RAD Studio version? Start Free Trial or Learn More About Upgrading Screenshot Gallery Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder. Design. Code. Compile. Deploy.Start Free Trial   Upgrade Today    Free Delphi Community Edition   Free C++Builder Community Edition

Read More

Learn About Using The Windows Subsystem For Linux (WSL) With Delphi

StoreIn this session, you can how to take advantage of the new Windows Subsystem for Linux (WSL) to develop, debug, and deploy Linux applications from Delphi. What is the Windows Subsystem for Linux (WSL) Windows Subsystem for Linux (WSL) is a compatibility layer for running Linux binary executables natively on Windows 10 and Windows Server 2019 Multiple distributions are available via the Microsoft Store (Ubuntu, Debian, OpenSUSE, Kali, Fedora e.t.c) Mostly focused on the command-line interface with limited support for GUI apps via the external X11 server Less abstraction and better Windows integration than a traditional Virtual Machine Similar to Hyper-V or Windows Sandbox Invoke Linux binaries from Windows and Windows executables from Linux Be sure to watch the whole session to learn: WSL Installation Managing WSL Distros Targeting from Delphi to Linux  Installation of the PAServer Automation All these steps are shown in action with real demos.

Read More

Powerful Chromium Based WebView Component To Host Web Content In Your Delphi/C++ Builder FireMonkey Apps

RAD Studio 10.4 Sydney brings support for working with web content through the Chromium-based Edge WebView2 browser control in VCL applications via the new TEdgeBrowser component. Embarcadero DocWiki But, this is for only the VCL applications currently. So, what if you want to utilize this feature in your FireMonkey application?! Problem solved! We have the WebView for FireMonkey component by WINSOFT which offers you to host web content in your applications. Uses Microsoft WebView2 API Supports Windows 32 and Windows 64 Available for Delphi/C++ Builder 6 – 10.4 Requires Microsoft Edge (Chromium) version 84.0.515.0 or higher After downloading the WebView component you should install the component. Here you can follow the installation video. Moreover, the WebView2Loader dynamic-link library should be with the executable file. You can find that dynamic-link library from the Library folder within the installed component files. Because the WebView2 is the part of the Microsoft WebView2 SDK. After configuring and installing, you can just create a FireMonkey application and drop the TFWebView component from the System category on the Palette. Using the TFWebView is similar to TWebBrowser or TEdgeBrowser.  Let’s start investigating the features of the TFWebView component. You can give the Uniform Resource Identifier (URI) using the Uri property. With the Zoom property, you can control the view. FWebView.Zoom := FWebView.Zoom – 0.1; FWebView.Zoom := FWebView.Zoom + 0.1; You can fetch the web document title by this code: Caption := ‘WebView – ‘ + FWebView.DocumentTitle; CapturePreview procedure takes a screenshot of the TFWebView component to save the screenshot you can just use the TMemoryStream. Here is a use case. procedure TFormMain.SpeedButtonCaptureClick(Sender: TObject); begin if CapturePreviewStream = nil then CapturePreviewStream := TMemoryStream.Create else CapturePreviewStream.Clear; FWebView.CapturePreview(pfPng, CapturePreviewStream, CapturePreviewCompleted); end; procedure TFormMain.CapturePreviewCompleted(Sender: TObject); const FileName = ‘preview.png’; begin CapturePreviewStream.SaveToFile(FileName); FreeAndNil(CapturePreviewStream); Open(FileName); end; procedure TFormMain.SpeedButtonCaptureClick(Sender: TObject); begin   if CapturePreviewStream = nil then     CapturePreviewStream := TMemoryStream.Create   else     CapturePreviewStream.Clear;   FWebView.CapturePreview(pfPng, CapturePreviewStream, CapturePreviewCompleted); end; procedure TFormMain.CapturePreviewCompleted(Sender: TObject); const FileName = ‘preview.png’; begin   CapturePreviewStream.SaveToFile(FileName);   FreeAndNil(CapturePreviewStream);   Open(FileName); end; TFWebView comes with some amazing functionalities like posting a web message to an HTML document.  Or, showing HTML in memory, like you give the HTML/CSS/JS code as a parameter of the ShowHtml procedure that then creates a document to you within the TFWebView.  Moreover, you can manipulate the HTML document by executing JavaScript code, for instance fetching elements by Id and setting a new value. For this, you can utilize the ExecuteScript procedure. Finally, the best feature is playing with the developer tools. For instance, using Browser methods, like executing the getVersion function. To use this option, you can call the CallDevTools procedure. Be sure to check out part two of this post. In the next one, we will go through these given examples with a full explanation. Head over and check out the full WINSOFT WebView for FireMonkey component.

Read More

Learn How To Work With MongoDB Dataset In A Delphi application Quickly Using ListView Sample App

MongoDB is a document database, which means it stores data in JSON-like documents, the most natural way to think about data, and is much more expressive and powerful than the traditional row/column model. How about connecting with MongoDB using FireDAC components in your Application and access the dataset to show in a list view? Don’t know where to start? This post will guide you to do that. MongoDB.ListView Sample App shows how to work with a sample MongoDB Database and show the data in the Listview. 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 MangoDB.ListView App: TFDPhysMongoDriverLink: To link the MongoDB driver to an application and set it up. In general, it is enough to only include the FireDAC.Phys.MongoDB unit into your application uses a clause. The TFDPhysMongoDriverLink component can be used to specify: The VendorHome – the MongoDB installation root folder. The VendorLib – the name and the optional path to the MongoDB client library. TFDConnection: To establish a connection to a DBMS and to manage associated datasets. TListView: FireMonkey component that you can use to hold and present various types of items. Implementation Details: Before implementing this, as a preliminary step, we need to have a MongoDB Server is running and accessible from your host. For Details, See Connect to MongoDB Database. The “restaurants” collection of the “test” database is provisioned with test data. To provision this collection, run the MongoDB Restaurants Demo, and click the Load Data button: You can find the MongoDB Restaurants Demo sample project at: Object PascalDatabaseFireDACSamplesDBMS SpecificMongoDBRestaurants This sample application illustrates how to connect to a MongoDB server, select specific documents from a sample collection “restaurants” using a select query, parse the selected document elements (JSON items), and then display the results using the TListView component. Create a select query to retrieve specific documents from the sample MongoDB collection “restaurants” using the TMongoCollection.Find method. Parse elements of the selected documents in one of the following ways: using the TJSONIterator.Find method. using the TJSONIterator.Next, TJSONIterator.Recurse, and TJSONIterator.Return methods. using the TJSONIterator.Iterate method. Display the retrieved data using the TListView component. Check out the full article in the DocWiki about the MongoDB.ListView Sample. MongoDB ListView Sample App Check out the full source code for the MongoDB.ListView projects for Delphi and C++Builder over on GitHub.

Read More

Blastoff Game Created With Open Source DirectX Engine Built In Delphi

Quad Engine is an open source DirectX game engine built in Delphi which also offers bindings for C++ and C#. Blast-off is a showcase game built in the quad Engine and available on Stream. It is described as “Blast-off is a hardcore jumper/runner/shmup, where your alter ego will be a ball of anti-matter seeking to leave our Universe. Anti-matter is extremely difficult to exist in our universe, because when it contact with matter it annihilates. This forces the hero to reach super-fast speed to break through the space-time and break through the limit, where he will find peace in the void.” The game engine itself has 10 different demos showing how to use various features in the engine. Additionally, there is a showcase section with 12 different games plus full source code built with the quad Engine. Quite an impressive feat of engineering in a small package. Game Engine http://quad-engine.com/ (on GitHub) Ready to get started with the latest RAD Studio version? Start Free Trial or Learn More About Upgrading On Steam https://store.steampowered.com/app/391140/Blastoff/ Screenshot Gallery Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder. Design. Code. Compile. Deploy.Start Free Trial   Learn More About Upgrading

Read More

Learn To Add Custom Text Rendering And Formatting Capabilities To Your Delphi FMX Controls Quickly

Most applications demand high-quality text rendering, resolution-independent outline fonts, and full Unicode text and layout support. Looking for a device-independent text layout system that improves text readability in documents and in UI for Your Delphi/C++ applications? How to build such Text Rendering Capabilities to your FireMonkey controls? This post will guide you. (e.g) Let’s see how to enhance the TLabel control with Rendering and formatting capabilities for the Text in HTML Tags. How to create:1. Create a descendant of TLabel that supports a limited selection of HTML tags. Parse the label for HTML tags every time the text changes.2. Override its Dochanged method to parse the text for HTML tags3. Use Firemonkey’s TTextLayout class to apply formatting attributes to parts of the text. Note: No need to use HTML for formatting instead we can use TTextlayout. TTextLayout is an abstract class that provides mechanisms to render text quickly. Such rendering systems are supported by DirectWrite API (Windows) and Core Text framework (OS X). Also used to calculate glyph positions, measure text, draw text, and covert to curves for path effects and 3D extrusion. To create this class, use TTextLayoutManager – In charge of choosing the appropriate layout class type for the current running platform. Use AddAttribute to assign text block properties like TTextRange (starting position and length) and TTextAttribute (font and color). When changing several properties of the layout, you should use the BeginUpdate and EndUpdate procedures. Use RenderLayout to render the text on a canvas. The PositionAtPoint method returns the position in the text by the position’s coordinates. The RegionForRange method returns the array of the rectangles surrounding the range of the text specified in ARange. Another feature is the ability to convert text to a TPathData object by calling the ConvertToPath procedure. Check out the full Video of creating a Simple FMX HTML control below.

Read More

Powerful Native Windows Open Source And Free Python IDE Built In Delphi

Embarcadero’s users understand the scalability and stability of C++ and Delphi, and depend on the decades of innovation those languages bring to development. Ninety of the Fortune 100 and an active community of more than three million users worldwide have relied on Embarcadero’s award-winning products over the past 30 years. Icons by Icons8.com. © 2020 EMBARCADERO INC. ALL RIGHTS RESERVED Legal

Read More

Structured Programming in Delphi – DelphiCon 2020

Have you heard of functional programming but are vague on the details?  Are you ready to expand beyond the object-oriented mindset?  Tomorrow, Nick Hodges, author of Coding in Delphi, will teach us how to harness functional programming techniques to craft beautiful programs in Delphi.  Just one day away, Functional Programming with Delphi is a knowledge-broadening talk you don’t want to miss! DelphiCon 2020 offers ten talks and four expert panels by Embarcadero tech partners and Most Valuable Professionals spanning the range of software from education to industrial database access. Come for the functional programming and leave with a greater understanding of how to maximize performance with Delphi. The conference is free and open to the public. Sign up now by clicking the “Save my seat” button at delphicon.embarcadero.com!

Read More