From the blog

Learn How Easy It Is To Create A Python Type In A Delphi Application With Python4Delphi Sample App

We have learned how to create a Python Module in Delphi and added some methods to it. It’s time to learn how to create a Python Type(Class) in Delphi. Creating a new class creates a new type of object, allowing new instances of that type to be made. Each class instance can have attributes attached to it for maintaining its state. Class instances can also have methods (defined by its class) for modifying its state. You can also use Python4Delphi with C++Builder. This post will guide you to create a Python Type in Delphi using Python4Delphi components. 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 Demo6 Sample App: TPythonEngine: A collection of relatively low-level routines for communicating with Python, creating Python types in Delphi, etc. It’s a singleton class. TPythonGUIInputOutput: Inherited from TPythonInputOutput (which works as a console for python outputs) Using this component Output property you can associate the Memo component to show the Output. TPythonDelphiVar: Inherited from TEngineClient, used to convert the python variable to the Delphi variable and vice versa. It has methods to set and get value as variant or PyObject. It contains property like Module(TPythonModule internally created by default) where the python variable(TPyVar) is created and later converted to and from the Delphi variant or PyObject. TPythonModule: It’s inherited from TMethodsContainer class allows creating modules by providing a name. You can use routines AddMethod, AddMethodWithKW, AddDelphiMethod, AddDelphiMethodWithKeywords to add a method which should be type compatible with this routine parameter. You can create events using the Events property. TPythonType: This component helps to create a new python type in Delphi which is inherited from the hierarchy of classes (set of APIs to create, manage methods, and members). 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 Demo6 sample project from the extracted repository ..Python4DelphiDemosDemo06.dproj. Open this project in RAD Studio 10.4.1 and run the application. Implementation Details: PythonEngine1 provides the connection to Python or rather the Python API. This project uses Python3.9 which can be seen in TPythonEngine DllName property. It Is assigned with InitScript which import sys module and prints the Python.Dll version, copyright information to Memo2. import sys print(“Python Dll: “, sys.version) print(sys.copyright) print() PythonGUIInputOutput1 provides a conduit for routing input and output between the Graphical User Interface (GUI) and the currentlyexecuting Python script. PythonDelphiVar1 component is intended for demonstrating how to assign value between Delphi(Edit1.Text)->Python Delphi variable(test.Value) and back from (test.Value) -> Edit1.Text using event PythonDelphiVar1GetData and PythonDelphiVar1SetData respectively. The data is passed as variant type here. PythonModule1 with Module name spam is created. During PythonModule1Initialization a method spam_foo,spam_CreatePoint,spam_getdouble is added to the Module. and the definition of these methods was included in the same unit file. In the method definition, we can use the python engine to manipulate between python and Delphi. In this sample, created a new Python Type(Point) which is a Delphi record that holds attributes Ob_refcount, X, Y positions, and a Pointer to TPyTypeObject. This Python type point is instantiated using the spam_CreatePoint routine. To get and set the attribute value for the created point instance, procedure PyPoint_getattr, PyPoint_setattrfunc is used. To represent the Point object procedure PyPoint_repr is used. To destroy the Point […]

Read More

Ultimate Enhanced Native Windows Task Manager Built In Delphi

Developer Michal Mutl with MiTeC has a powerful enhanced task manager utility available which is built in Delphi. The features in this enhanced task manager make it one of the most advanced task managers for Windows that I have seen. There are so many features here it’s incredible. According to the feature list Task Manager Deluxe (TMX) provides real-time observing of: running processes, installed services and drivers, available network adapters, network connections by process, network traffic, disk and I/O utilization, active terminal sessions, autostart entries, cpu usage, frequency and other advanced stats, gpu usage and gpu engines usage, memory map and utilization, system information, opened/locked files finder, machine journal, user account list, monitor layout view, and windows available updates. This is a great example of a native Delphi application and the speed and power that a native application can bring to a solution. It also features both light and dark modes which is a nice touch (and super easy in Delphi)! Website https://www.mitec.cz/tmx.html Screenshot Gallery

Read More

Flexible FireMonkey Material Design Templates Available Via GetIt In Delphi

The Bottom Navigation template is designed to embrace the Material Design user interface and user experience philosophy. It looks great on both iOS and Android and works on Windows for testing. The template has eight different varieties within the application as different forms. Basic – ufrmBasic Shifting – ufrmShifting Light – ufrmLight Dark – ufrmDar Icon – ufrmIcon Primary – ufrmPrimary Map Blue – ufrmMap Light Simple – ufrmLightSimple Most of the forms contain various tabs that you move between as you tap the buttons at the bottom. The tabs content looks mostly alike, so it may not be obvious that you are moving between tabs. Each one of the forms contains different examples of use cases of FireMonkey that you can apply to your projects easily.  With GetIt you can easily search and get the full template: There are a lot of subtle design elements that you may want to replicate in other applications, even if you don’t use these templates completely. To use these templates in your project just copy the unit and form file to your project. You can further customize them and remove the TListView from them as well. Be sure to check out other templates on Embarcadero GetIt!

Read More

Leveraging High DPI with Ray Konopka – DelphiCon 2020

Have you ever accessed a website on your mobile device and found that it was formatted for desktop and nearly unreadable on a 5″ screen?  Similar problems occur for users running high-DPI screens. As 4K screens proliferate and the consumer pressure for 8K grows, it’s important to adjust user interfaces to prevent forms and controls from becoming unreadably small on high-resolution monitors.  RAD Studio 10.3 Rio and Rio Update 2 introduced enhanced controls for high-DPI applications to remedy this problem and Ray Konopka of Raize Software, Inc. is here to teach us how to maximize their advantages. Just seven days away, Leveraging High DPI in VCL Applications is a must-see talk for all developers, hobbyists, and RAD Studio enthusiasts looking to gain new techniques to stay relevant in our changing software landscape. 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 High-DPI knowledge and leave with a greater understanding of Delphi web applications. 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

Use 100% of TAdvWebBrowser

TAdvWebBrowser/TTMSFNCWebBrowser TAdvWebBrowser or TTMSFNCWebBrowser are both the same components. The first one is a component that is available in TMS VCL UI Pack and the TTMSFNCWebBrowser is included in TMS FNC Core. This component can display web pages, HTML and load files such as PDF files. Both browsers also allow executing scripts and catch the result in a callback. Get started You will need to take some additional steps to get started with the TAdvWebBrowser. The component is based on the Microsoft Edge Chromium web browser, so first of all this should be installed. Luckily Edge Chromium is now the default browser that Windows is distributing with the Windows 10 updates. Another important remark is that you can use the normal version of Microsoft Edge and you don’t need to intall one of their specific channels. Another thing that you will need is the WebView2Loader DLL file. There is a 32-bit and 64-bit DLL, the use of one of these depends on the version of the application that you want to build. You can find these files in the ‘Edge Support’ folder which comes with the installation package. These need to be placed in the systems folder of your system. In case you are working on a 32-bit system, you will need to put the file in the System32 folder. If you are working on a 64-bit system the file needs to be in the SysWOW64 folder as Delphi is a 32-bit program. More information on the setup can be found here. Now you are ready to start working with the TAdvWebBrowser. TAdvWebBrowser built-in features To start with the TAdvWebBrowser it can be as easy as placing the component on the form and setting the URL property to the link that you want. If you want to give the user some more control, we’ve created a demo application, in which you can navigate via a TEdit and have buttons to go forward and backward. This is easily done with the following code: AdvWebBrowser.Navigate(AURL); AdvWebBrowser.goBack; AdvWebBrowser.goForward; With the OnNavigationComplete event you can check if the webbrowser changed to the desired page. In this code sample we will add the URL to a listbox and check if we can go back or forward between the web pages. procedure TForm.AdvWebBrowserNavigateComplete(Sender: TObject; var Params: TAdvCustomWebBrowserNavigateCompleteParams); begin ListBox1.Items.Add(Params.URL); Back.Enabled := AdvWebBrowser1.CanGoBack; Forward.Enabled := AdvWebBrowser1.CanGoForward; end; Some other things that you can do is set your own HTML code. AdvWebBrowser1.LoadHTML(MyHTML); Go to the next level You can get much more out of your TAdvWebBrowser with the use of some simple methods. With the ExecuteJavascript method, you can run the JavaScript code that you want in your browser. For example you can set the inner HTML of an object, in this case a paragraph. AdvWebBrowser.ExecuteJavascript(‘document.getElementById(“myParagraph”).innerHTML = “‘ + s + ‘”;’); DOM access is currently not possible in the TAdvWebBrowser itself, but you can retrieve the HTML text of your page via this function as well. And you can make it readable by parsing the retrieved text to JSON. In this case it is done in an anonymous callback method. AdvWebBrowser.ExecuteJavascript(‘function GetHTML(){return document.documentElement.innerHTML;} GetHTML();’, procedure(const AValue: string) begin memo.Lines.Text:= TJSONObject.ParseJSONValue(AValue).Value;; end ); With the use of this JavaScript method, you can get almost everything out of this control. TAdvWebBrowser also supports bridging between the client and the […]

Read More

Learn How To Use C++ Lambda Expressions In C++17 With C++Builder

C++ got lots of additions throughout C++11, C++14 and C++17. Currently, C++ is a completely different language than it use to be. This Modern C++ post explains how to use the Standard Template Library and the most important features of the C++17 that will greatly help you write readable, maintainable, and expressive code! One of the new features of C++11 was lambda expressions. Throughout C++11, C++14, and C++17, the lambda expressions got some new additions that made lambda expression even more powerful.  If you do not know what lambda expression is, here is the answer: Lambda expressions or lambda functions construct closures. A closure is a very generic term for unnamed (temporary) objects that can be called like functions and can capture variables in scope. Lambda expressions are a great way to help to make code generic and tidy. Lambda expressions can be used as parameters for real generic algorithms to specialize in what those achieve when processing specific user-defined types.  With lambda expressions, we can encapsulate code to call it later, and that also might be somewhere else because we can copy them around.  Or we can also encapsulate code to call it multiple times with different parameters. Let’s have a real example: #ifdef _WIN32 #include #else typedef char _TCHAR; #define _tmain main #endif #include #include using namespace std; int _tmain(int argc, _TCHAR* argv[]) { string hello = “C++”; string world = “17”; auto add_things = [](auto a, auto b) { return a + b; }; auto i = add_things(1, 2); auto s = add_things(hello, world); cout 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 #ifdef _WIN32 #include #else typedef char _TCHAR; #define _tmain main #endif   #include #include   using namespace std;   int _tmain(int argc, _TCHAR* argv[]) {     string hello = “C++”;     string world = “17”;       auto add_things = [](auto a, auto b) { return a + b; };       auto i = add_things(1, 2);     auto s = add_things(hello, world);   cout i endl; cout s endl;   cout [](auto a, auto b){ return a + b; }(2, 2) ‘n’;       system(“pause”);       return 0; } Pay attention to this line: auto add_things = [](auto a, auto b) { return a + b; }; auto add_things = [](auto a, auto b) { return a + b; }; This is easy to use, just like any other binary function. As we defined its parameters to be of the auto type, it will work with anything that defines the plus operator (+), just as strings do. And here we are using the lambda expression and printing the output to the console: auto i = add_things(1, 2); auto s = add_things(hello, world); cout auto i = add_things(1, 2); auto s = add_things(hello, world);   cout i endl; cout s endl; We do not need to store a lambda expression in a variable to utilize it. We can also define it in place and then write the parameters in parentheses just behind it (2, 2): cout cout [](auto a, auto b){ return a + b; }(2, 2) ‘n’; As you can see this is the syntax for lambda expressions. The shortest lambda expression possible is []{}, it just accepts no […]

Read More

Embarcadero Black Friday Week Promo

Embarcadero Sydney 10.4  Contactați-ne pentru informații suplimentare: vanzari@d-data.ro Cele mai tari oferte de Black Friday pentru soluțiile Embarcadero. Anunțăm Black Friday Week Promo – numai în perioada 23 – 30 Noiembrie 2020 aveți posibilitatea să procurați soluții Embarcadero la super preț: RAD Studio Professional – 1799 euro fără TVA (2999 euro) RAD Studio Enterprise- 2999 euro fără TVA (4999 euro) RAD Studio Architect- 4099 euro fără TVA (6999 euro) Contactați echipa noastră pentru prețuri promoționale pentru IDE Delphi și C++ Builder! Solicitare Ofertă Completați formularul de mai jos pentru o ofertă personalizată. Terms & Conditions: Oferta valabilă în perioada 23 Noiembrie 2020 – 30 Noiembrie 2020. Oferta disponibilă doar la achiziția soluțiilor RAD Studio, Delphi și C++ Builder 10.4 Sydney (All Editions). Tipuri de licențe incluse în promoție – ESD, Network Named, Concurrent. Academic licenses și maintenance renewals,nu fac parte din aceasta ofertă. Embarcadero își rezervă dreptul de a modifica, anula sau amâna oricând prezenta ofertă Prezenta ofertă nu este aplicabilă daca contravine legislației locale. Se pot aplica restricții adiționale. Cum beneficiați de ofertă: Solicitați o ofertă partenerului local Embarcadero și plasați comanda înainte de data de încheiere a promoție

Read More

Delphi Compiler And LSP Patch for RAD Studio 10.4.1

Embarcadero has just released a new patch for RAD Studio 10.4.1. This includes Delphi compiler improvements and Delphi LSP improvements. The patch is available in GetIt, and the RAD Studio IDE Welcome page should indicate its availability. The patch is also going to be available in the my.embarcadero.com customers download portal. Read on to learn more about this patch and the two GetIt packages to deliver it. Delphi Compiler and Code Completion Patch This patch addresses two issues in the Delphi 10.4.1 compiler: a data layout issue with specific alignments, logged in Quality Portal as RSP-30890 and RSP-30787, and a performance issue when recompiling, logged as RSP-22074, RSP-30714, and RSP-30627. The performance improvement provided in this patch also helps with performance for Code Insight when using the LSP server. The patch comes in two packages. The first includes updated compilers for all platforms available in Delphi and RAD Studio Professional. The second package includes the Linux compiler and it is available only for Enterprise customers. Delphi and RAD Studio Enterprise customers should see and install both packages (the order doesn’t really matter, as they are independent). Each of these GetIt packages is a deferred package, which means you select it but the actual download and installation takes place when you close the RAD Studio IDE, as it replaces files the IDE uses. Just follow the steps, wait for the GetItCmd console app to perform the process, and notice that the files replaced in your RAD Studio installation folders are copied into a special backup directory under the main install location. See screenshot below for one of the steps of the automatic installation process: After the deferred installation, RAD Studio will reboot and the patch will show as installed in the GetIt Package Manager dialog and in the Welcome Page. Enterprise users will have to install both packages to see the Welcome Page notification go away.

Read More

[InfoGraphic] DevOps, Development and RAD Studio

DevOps is a term I’m hearing more and more during customer conversation, and I am often sharing the different ways that Delphi, C++Builder and RAD Studio programming supports DevOps. (Keep reading – free infographic below) The term DevOps originates back to around 2008/9 when the two worlds of Development and Operations were traditionally stereotypes as Dev V Ops, with typical exchanges like “It’s not my machines, it’s your code!” – “No, it’s not my code it’s your machines!”. These stereotypes were built from friction found in the key business requirement for almost any system – making changes! The ability to rapidly make changes is important if you want to stay ahead of the competition. RAD developers are used to Agile development and being able to create changes quickly, however, getting them deployed needs Operations. To the Operations team, making changes brings a high-risk of an outage, but this prevents innovations from being pushed in a timely manner. This conflict is something that DevOps acknowledges and tries to breakdown through new ways of working that bring both sides closer together. Over the years, the two worlds of Dev and Ops have had to start thinking more like each other, including, how to get feedback from live environments to find issues that appear in the code. Agile, and DevOps like to re-use and expand, so rather than giving a full-blown commentary on how RAD Studio supports Delphi and C++ Builder developers today, let me keep it simple and say that the libraries, components, toolchains (and more) found in RAD Studio, and our wider partner ecosystem, provide broad support to both Developers and Operations teams who need to communicate and share what is happening in the field. The component-based architecture and cross-platform libraries that work across multiple systems are the perfect foundation stone for rapid agile development, that can be supported simply. But finally, a picture paints a thousand words. This is just a snapshot of the RAD eco-system, there is too much to put everything on here, but I hope this gives a flavor of just the tip of the iceberg, and how the RAD Studio IDE, and the Delphi and C++Builder languages and libraries are enabling development teams the world over to support DevOps today. RAD Studio DevOps InfoGraphic Download Infographic PDF

Read More

Start Creating Powerful FireMonkey Linux Applications In 1 Hour With This Video Tutorial

Let’s start creating a visually stunning Linux application with Delphi FireMonkey! In this webinar, you can arrange all the needed steps to start creating Linux solutions.  Overview Installation Supported platforms PAServer SDK & Packages Usage UI Elements Samples Database Access FireDAC Migrating from Windows VCL 3rd Party Support Broadway Web Why FMX on Linux? Save money on Windows licenses Kiosk or Point of Sale – Single-purpose computers with locked-down user interfaces Linux offers more security options IoT & Industrial Automation – Add user interfaces for integrated systems Many government systems require Linux support Delphi for Linux History 1999 Kylix: aka Delphi for Linux, introduced 2002 Kylix 3 was the last update to Kylix 2017 Delphi 10.2 Tokyo introduced Delphi fir x86 64bit Linux 2017 Eugene Kryukov of KSDev release FmxLinux 2019 Embarcadero includes FmxLinux with Delphi 10.3.2 Rio Be sure to check out the whole session to learn all the steps to get started your Linux development! Head over and find out more about Delphi and Linux over in the Embarcadero DocWiki!

Read More