Delphi

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

Quickly Learn To Use Delphi Classes To Create A New Python Type With Python4Delphi Sample App

import spam p = spam.CreatePoint(2, 5) print (p) p.OffsetBy( 3, 3 ) print (p.x, p.y) print (dir(spam)) print (spam.Point) print (“p = “, p, ”  –> “,) if type(p) is spam.Point:   print (“p is a Point”) else:   print (“p is not a point”) p = 2 print (“p = “, p, ”  –> “,) if type(p) is spam.Point:   print (“p is a Point”) else:   print (“p is not a point”) p = spam.CreatePoint(2, 5) try:   print (“raising an error of class EBadPoint”)   p.RaiseError() # it will raise spam.EBadPoint except spam.PointError as what: #it shows you that you can intercept a parent class   print (“Caught an error derived from PointError”)   print (“Error class = “, what.__class__, ”     a =”, what.a, ”   b =”, what.b, ”   c =”, what.c)   # You can raise errors from a Python script too! print (“——————————————————————“) print (“Errors in a Python script”) try:   raise spam.EBadPoint(“this is a test !”) except:   pass   try:   err = spam.EBadPoint()   err.a = 1   err.b = 2   err.c = 3   raise err except spam.PointError as what: #it shows you that you can intercept a parent class   print (“Caught an error derived from PointError”)   print (“Error class = “, what.__class__, ”     a =”, what.a, ”   b =”, what.b, ”   c =”, what.c)   if p == spam.CreatePoint(2, 5):   print (“Equal”) else:   print (“Not equal”)

Read More

Astral Heroes Is A Beautiful Multiplayer Collectible Card Game Built In Delphi

Developer Ivan Polyacov from Apus Software created Astral Heroes in Delphi. According to the site it is a collectible card game that’s simple to learn, exciting to play, and deep enough to challenge even the greatest strategists. It uses a truly fair Free-­to-­Play model that never hides the best content behind “pay walls” according to the developer. Some of the features of this beautiful game include: Fast-paced and simple core gameplay, 3 different game modes, Custom Decks: Construct and play a deck of your own personal design, Random Decks, Draft Tournament, a deep library of well­ balanced creatures and spells, A global Online League, Sophisticated and merciless AI opponents that will test your mettle, and a rich single ­player campaign. If you want to find out more about why Ivan selected Delphi and more about this development process check out this YouTube code review video. Website http://astralheroes.com/ Download https://store.steampowered.com/app/488910/Astral_Heroes/ Open Source Game Engine https://github.com/Cooler2/ApusGameEngine Screenshot Gallery

Read More

Delphi at the University – DelphiCon 2020

Are you a teacher, educator, or parent of a child interested in programming?  Are you looking for a simple but powerful language and student-friendly integrated development environment? With it’s combination of full-language features, simple syntax, and visual drag-and-drop development, Delphi rocks its competition. Still unsure? Let Victory Fernandes, a former mathematics and computer science professor at Brazil’s Unifacs University, walk you through the benefits of Delphi in education in his talk Delphi at the University – Insights for Students and Teachers. This presentation and Q&A session is free of charge and bundled with nine other talks and four panels by industry professionals.  Sign up now by clicking the “Save my seat” button at delphicon.embarcadero.com.

Read More

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

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