From the blog

Learn How To Use Auto-Typed Variables In C++ For Windows Development

auto-typed variables is a C++11 feature that allows the programmer to declare a variable of type auto, the type itself being deduced from the variable’s initializer expression. The auto keyword is treated as a simple type specifier (that can be used with * and &), and its semantics are deduced from the initializer expression. auto-typed Variables Examples int IntFnc() {} bool BoolFunc() {} char* CharSFunc() {} int _tmain(int argc, _TCHAR* argv[]) { // x is int auto x = IntFunc(); // y is const bool const auto y = BoolFunc(); // w is char* auto w = CharSFunc(); return 0; } int IntFnc() {} bool BoolFunc() {} char* CharSFunc() {}      int _tmain(int argc, _TCHAR* argv[]) {     // x is int     auto x = IntFunc();     // y is const bool     const auto y = BoolFunc();     // w is char*     auto w = CharSFunc();       return 0; } Multi-declarator auto The C++11 standard includes the multi-variable form of auto declarations, such as: int* func(){} int _tmain(int argc, _TCHAR* argv[]) { auto x = 3, * y = func(), z = 4; return 0; } int* func(){}   int _tmain(int argc, _TCHAR* argv[]) {         auto x = 3, * y = func(), z = 4;         return 0; } The restriction with multi-declarator auto expressions is that the variables must have the same base type. For example, the following line of code is well-formed: auto x = 3, y = *(new int); auto x = 3, y = *(new int); because x and y have the same base type : int, while the following code: will generate the error: [bcc64 Error] File1.cpp(11): ‘auto’ deduced as ‘int’ in declaration of ‘x’ and deduced as ‘double’ in declaration of ‘y’. This feature is supported by the Clang-enhanced C++ compilers. Check out all of the modern C++ language features supported in the latest C++Builder for Windows development.

Read More

Learn To Build Modern Enterprise-Grade Native Applications For Windows With RAD Studio

In this webinar, one of the Embarcadero MVP Serge Pilko shows off the RAD Studio against Electron and other JavaScript frameworks for desktop application development. Overview Native desktop development for Windows JavaScript framework-based solutions vs. RAD Studio for Windows Development Electron & Node.js .NET WinForms & WPS vs. Delphi & C++ Builder VCL or FMX JavaScript for Desktop Many JavaScript libraries let you create desktop GUI applications with web technologies like JavaScript, HTML, and CSS. And it is connected to the web easily. With JavaScript desktop development libraries you can’t get the native performance, no native user interface.  Consumes more memory because your JavaScript application needs an engine Source code protection issue Not all enterprise developers are ready to rely on open-source solutions  Delphi & C++ Builder for Desktop A proven tool for Windows desktop development Small executable file size and low memory usage Native application The best performance you can get Thousands of use cases are ready to explore Native look and feel Easy to design and bring the best user experience Be sure to check out the whole session to learn about the benchmarks in action and more about modernizing your applications! Learn more about enhancing your productivity with RAD Studio.

Read More

More TMS WEB Core Tips & tricks

Today we want to bring to your attention two totally different TMS WEB Core features. These little tidbits that can bring your TMS WEB Core web client application from good to great. The first is about handling application termination and the second is about getting something more out of TWebStretchPanel. Application termination For long, handling web application termination was simple: it was not really handled. When there was a reason to handle it server side, software developers came up with the concept of sessions. In a nutshell, when a user first requests a HTML page from the server, a session is started and typically a session timer runs. If the users requests a page update or performs another request from the user, the session timer is reset. If the user does nothing or worse, closes the browser, the server timer runs and when it reaches a predefined time, for example 20 minutes, the session is considered closed and thus stopped. We have all experienced the consequences. You decide to go and grab a cup of coffee, meet a colleague in the coffee room, have an interesting talk that of course takes longer than expected and you return to your desk, want to continue using your web application and you are greeted with a session timeout and need to login again. In the world of modern single-page web client applications with stateless REST backend, this is a lot less likely to occur as it is way less likely to have a reason for server side session management. An easy way to look at it, is that the session state is now kept in the client and the web client application will just perform stateless HTTP(s) requests to a backend when data update or retrieval is needed. And still, even in this much more server resource friendly scenario, developers might have a reason to know when the user closes the web application to save something client or server side. To handle this, modern browsers expose the browser window “unload” and “onbeforeunload” JavaScript event. This event is triggered when the browser window is about to be closed or the user leaves the page via navigation. Other than just handling leaving the web client application, it can also be signalled to the user and a confirmation dialog shown to ask if the user really wants to leave. In TMS WEB Core, taking advantage of this is really simple. In your TMS WEB Core web client application, handle the main form’s OnBeforeUnload event. If you wish to show a confirmation dialog, return the confirmation message text via the parameter AMessage. Note that in Google Chrome, a confirmation message will be shown when the message is not empty but it will contain the standard Google text. For the reason, see: https://bugs.chromium.org/p/chromium/issues/detail?id=587940 Here is a code extract that shows the concept. A simple string variable will determine whether some action is needed before closing or not. This string s is empty by default but during application execution can be set (here via a button click). When this string is not empty, it is used to show a prompt when the user wants to close the application via the form.OnBeforeUnload event and in the form.Unload event it can be effectively handled to do a last action before unloading. […]

Read More

Learn How To Build Decoupled Delphi Applications Quickly With Delphi Event Bus Framework

Modularity is very important in software architecture so that applications built can be easily extendable and maintainable. Consider your building an application with multiple components in it. If we decide to remove a component and replace it with another component it should not affect the application. This can be done by decoupling software architecture. Do you want to build such decoupled applications in Delphi? This post guide you to build using Delphi Event Bus Framework. EventBus: An event bus allows publish/subscribe-style communication between components without requiring the components to explicitly be aware of each other. Looks like Observer Pattern? No, there is a difference. In the observer pattern, the broadcast is performed directly from the observable to the observers, so they “know” each other. But when using a publish/subscribe pattern, there is a third component, called event bus, which is known by both the publisher and subscriber. It is Decoupled between Publisher and Subscriber. Delphi Event Bus allows you to decouple components that asynchronously receive and process events and or emit events. Consumers can subscribe to this event bus and declaratively specify which events they wish to consume. The event consumer a publisher is completely decoupled. Simplifies the communication between components. Delphi Event Bus Features: Easy and clean: DelphiEventBus is super easy to learn and use because it respects KISS and “Convention over configuration” design principles. By using default TEventBus instance, you can start immediately to delivery and receive events Designed to decouple different parts/layers of your application Event-Driven, Thread Safe, Unit Tested Attributes based API: Simply put the Subscribe attribute on your subscriber method you are able to receive a specific event Support different delivery modes: Specifying the TThreadMode in Subscribe attribute, you can choose to deliver the event in the Main Thread or in a Background one, regardless of where an event was posted. The EventBus will manage Thread synchronization. How it works : TEvent = class(TObject) // additional information here end; TEvent = class(TObject) // additional information here end; Prepare subscribers: Declaring your subscribing method: [Subscribe] procedure OnEvent(AEvent: TAnyTypeOfEvent); begin // manage the event end; [Subscribe] procedure OnEvent(AEvent: TAnyTypeOfEvent); begin   // manage the event end; Prepare subscribers: Register your subscriber: GlobalEventBus.RegisterSubscriber(self); GlobalEventBus.RegisterSubscriber(self); GlobalEventBus.post(LEvent); GlobalEventBus.post(LEvent); Check this below video for Demonstration of How the Delphi Event Bus Framework(DEB) works. Delphi Event Bus Demonstration Checkout the full source code for Delphi Event framework here.

Read More

Awesome Pascal Is A Curated List Of Awesome Open Source Delphi Pascal Frameworks, Libraries, Resources, And More

Developer Anton Frost has a curated listed of Awesome Delphi projects available over on GitHub. It offers a wide variety of projects across multimedia, game development, GUI, scripting, database, reporting, utilities, serial ports, memory management, and much more. Take A Look According to the project “only open-source projects are considered. Dead projects (not updated for 3 years or more) must be really awesome or unique to be included.“ You can submit your own projects to the list by creating a pull request to get projects included. This awesome collection is formatted and available on Delphi.ZEEF.com as well.

Read More

Learn Useful Hints For Working With Styles To Build Visually Stunning Windows Applications

Want to style your Delphi/C++Builder applications with few steps? Want to view and choose your style before applying to your application? Don’t know how to do? This post will guide you. A style is a set of graphical details that define the look and feel of a VCL/FMX application. Similar to a theme in Windows. A style permits you to change the appearance of every part and state of a control.   Where are the styles on your computer? C:UsersPublicDocumentsEmbarcaderoStudio21.0Styles. Plenty of styles available under this folder, you can choose from here. Where can you get other styles from? Use Tools -> Get it Manager -> Styles -> Select one among them and install. After installing these styles can be found under this folder C:UsersPublicDocumentsEmbarcaderoStudio21.0Styles With folder names per platform like -> Android, iOS, macOS, Linux, and Win. Other these styles, we can get some third party Styles from DelphiStyles How to view your styles? Navigate to his folder, C:Program Files (x86)EmbarcaderoStudio21.0binVCLStyleViewer.exe and pass the parameter with the Style name with path. Similarly for FMX Styles use FMXStyleViewer.exe. Alternatively, you can open the style files, by right click-> open with ->Navigate to VCLStyleViewer.exe or FMXStyeViewer Accordingly. How to convert VCL-Styles to FMX- Styles? Open IDE->Tools->Bitmap Style Designer and open the existing VCL styles and then Save the file as FMX style with Option Save as type value “FireMonkey Style” How do I assign a style to the program? Place a TStyleBook component to the form. Double Click and open the style file from the location mentioned above. Save and close the Style Designer. Assign the Stylebook reference to Form StyleBook Property. Use TStyleBook.UseStyleManager property checked when more than one form created from the main form where StyleBook property is assigned. Note: For Dialogs in FMX the styles are not applied, we need to create custom dialogs. How do I assign a style per platform? On Double-clicking the TStyleBook -> Style designer contains the option Platform where you can choose your platforms. How to set styles for multi-platform in a single application? You can use style manager to set the styles at runtime, but we need to take care of checking the platform, and deployment as well. A Simple solution is to use different data modules for each platform and place TStyleBook in each platform, instantiate according to the platform. Check this full video of useful hints for working with styles. Check out the High DPI Styles and VCL Styling Per Control feature introduced in Latest RAD studio 10.4.1

Read More

Learn A Faster Way To Make A Python Module As A DLL Using Python4Delphi Sample App

Sometimes we may need to share the functionalities as DLL and we know, creating a DLL in Delphi is a simple task. We learned how to create Python Module and add methods to it in Delphi. How about making a python module as DLL using Python4Delphi and import this python module in another application? This post will guide you to do that. You can also use Python4Delphi with C++Builder. Python4Delphi Demo9 Sample App shows how to create a Module, add a routine to that module, Import the module in a python script, and access the added routine. You can find the Demo9 source on GitHub. Prerequisites: Download and install the latest Python for your platform. Follow the Python4Delphi installation instructions mentioned here. Alternatively, you can check out this video Getting started with Python4Delphi. Components used in Python4Delphi Demo9 App: No visual components were added to the library however the following class were instantiated by using PythonEngine.pas TPythonEngine: A collection of relatively low-level routines for communicating with Python, creating Python types in Delphi, etc. It’s a singleton class. TPythonModule: It’s inherited from TMethodsContainer class allows creating modules by providing a name. You can use routines AddMethod, AddMethodWithKW to add a method of type PyCFunction. You can create events using the Events property. TMemo: A multiline text editing control, providing text scrolling. The text in the memo control can be edited as a whole or line by line. You can find the Python4Delphi Demo9 sample project from the extracted GitHub repository ..Python4DelphiDemosDemo09.dproj. Open this project in RAD Studio 10.4.1 and run the application. Implementation Details: This Sample contains one library project(demodll) and a VCL application project(Demo09). Demodll contains a procedure PyInit_demodll which will create an instance of TPythonEngine and TPythonModule. PythonEngine loads the python DLL using the LoadDll procedure. PythonModule named ‘demodll’ will have a method to add 2 integers. See the code below. When building this project, demodll.pyd is created. function PyInit_demodll : PPyObject; begin Result := nil; try gEngine := TPythonEngine.Create(nil); gEngine.AutoFinalize := False; gEngine.UseLastKnownVersion := False; gEngine.RegVersion := ‘3.9’; //

Read More

Powerful Native File And Folder Comparison Tool Is Built In Delphi

Beyond Compare is a data management utility that allows users to compare and reconcile documents, files, folders, and even whole system drives quickly and easily. It’s a deeply useful resource, and it is built and powered by Delphi. According to the Beyond Compare website “You can compare entire drives and folders at high speed, checking just sizes and modified times. Or, thoroughly verify every file with byte-by-byte comparisons. FTP sites, cloud storage, and zip files are integrated seamlessly, and powerful filters allow you to limit what you see to only what you’re interested in.” Additionally, it offers three way merge which is explained as “Beyond Compare’s merge view allows you to combine changes from two versions of a file or folder into a single output. Its intelligent approach allows you to quickly accept most changes while carefully examining conflicts.” And it offers syncing folders which is described as “Beyond Compare’s intuitive Folder Sync interface lets you reconcile differences in your data automatically.” Website https://www.scootersoftware.com/ Screenshot Gallery

Read More

Learn How To Modernize And Integrate WinAPI, COM, ShellAPI, And WinRT Into Your Windows VCL Applications

In this webinar, learn how to access all the APIs on Windows 10 from RAD Studio, Delphi, and C++Builder. Overview Traditional Core APIs Shell Integration WinRT and more Windows API Evolution Over Time Classic API 1985 (Win1) Win16 -> Win32 -> Win32(w/Unicode) -> Win64 COM, OLE Automation, Shell, etc WinRT Classic Windows API Kernel, User, GDI Delphi bindings for the Windows API (C language API) Load time linking vs. dynamic invocation vs. delay loading Message handling TWinControl Delphi TWinControl Wraps Windows handles, CreateWindows, API calls Used for platform controls and custom controls Used for form The entire VCL library wraps Windows APIs, plus some native concepts Component inheritance, actions, visual form inheritance, frames, styling, component messages, delayed creation, handle re-creation Be sure to check out the whole session to learn about COM, Interfaces, Shell integration concepts, and modern WinRT. Moreover, TaskBar and JumpList components in action.  Learn more about the Delphi VCL and Windows development in the Embarcadero DocWiki.

Read More

Installing Component Packages Manually

Sometimes you need to install components manually. Maybe the installer wasn’t updated for your version of Delphi, or it is an open-source library without an installer. Whatever the reason, here is a short guide in addition to what is found in the DocWiki on the topic. I’m going to write this guide around installing the Radiant Shapes Pack available via GetIt. I’m guessing it wasn’t updated to install in 10.4 yet, and while R&D is working on that this is a great opportunity to learn how to install it manually. After installing from GetIt, you will not find it in the IDE, and it is missing from the packages list, which you access from Component 🡆 Install Packages while no project is open This is where all the BPL Packages are listed. Click the Add button and browse to find the BPL C:Program Files (x86)RaizeRadiantShapes1.4BinRadiantShapesFmx_Design270.bpl (If you don’t have that BPL or path for Radiant Shapes, then make sure you installed from GetIt and you can run the installer manually from C:UsersPublicDocumentsEmbarcaderoStudio21.0CatalogRepositoryRadiantShapes-270-1.2InstallerRadiantShapes.exe ) or whatever design-time package you need. This will install the components into the IDE. Many projects have both design time and runtime packages. A design-time package contains the information necessary to install in the IDE, and any special designers, while RunTime packages only contain the code necessary for use during RunTime. You can optionally even ship these packages with your binary to link them at runtime. Next, you need to tell the IDE where to find the DCUs and optionally source files. What if you only have source files? No problem, open and build all the packages at least in Release Mode on each platform the library suports. Then head to Tools 🡆 Options then Language 🡆 Delphi 🡆 Library. Then complete the details for each platform you built and want to support: Selected Platform – Specifies which platform you are providing details for below: Linux 64-bit, iOS 64-bit, Win 32-bit, Win 64-bit, macOS 64-bit, Android 32-bit, Android 64-bit, and/or iOS Simulator. Library Path – This is the path to the Release DCUs. Some people point to their PAS files here, which works, but then you end up recompiling the library more than necessary. Radiant Shapes includes all the DCUs in subfolders off the path C:Program Files (x86)RaizeRadiantShapes1.4Lib Tip: Paste the new path into the edit box before clicking the browse button if you need to browse to a subfolder. Then be sure to click [Add] when you are done. Library Paths Dialog Location of platform specific DCU folders for Radiant ShapesC:Program Files (x86)RaizeRadiantShapes1.4Lib Browsing Path is where you optionally add a path to the source PAS files. This lets you browse out to those source files from the IDE with the Find Declaration context menu item. For Radiant Shapes, the source is found in C:Program Files (x86)RaizeRadiantShapes1.4Source Debug DCU Path allows you to optionally point to the debug version of the DCUs. This is useful if the debug version has additional information or different behaviors. Radiant Shapes doesn’t have special debug DCUs so we don’t need to add anything here. Once you’ve completed these settings for each platform you are good to go! Happy installing!

Read More