From the blog

Learn About Using Delphi Methods As Python Functions With Python4Delphi Sample App

Earlier we have seen how to add methods in Python Module using Python4Delphi TPythonModule component’s Add Method. However, the Add Method parameter uses a PyCFunction type parameter. In many cases, we may need to define the method which should return Delphi Type. How to do that? This post will provide a way to do that using the TPythonModule component itself. You can also use Python4Delphi with C++Builder. Python4Delphi Demo7 Sample App shows how to create a Module, add a Delphi Method to that module, Import the module in a python script, and access the added routine. You can find the Demo7 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 Demo5 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. TPythonModule: It’s inherited from TMethodsContainer class allows creating modules by providing a name. You can use routines AddDelphiMethod, AddDelphiMethodWithKW to add a method of TDelphiMethod type. The difference between using AddMethod and AddDelphiMethod is the method parameter type which uses PyCFunction and TDelphiMethod respectively. 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. Note: This Demo also uses TPythonType component but this post doesn’t cover that. To learn about TPythonType check this post. You can find the Python4Delphi Demo7 sample project from the extracted GitHub repository ..Python4DelphiDemosDemo07.dproj. Open this project in RAD Studio 10.4.1 and run the application. Implementation Details: PythonEngine1 component 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 using this InitScript. import sys print(“Python Dll: “, sys.version) print(sys.copyright) print() PythonGUIInputOutput1 component provides a conduit for routing input and output between the Graphical User Interface (GUI) and the currentlyexecuting Python script. PythonModule1 with Module name spam is created. During PythonModule1Initialization a method spam_getdouble and spam_getdouble2 is added to the Module. And the definition of the method is included in the same unit file. Logically a python module is created and its methods were created using this PythonModule. Later this can be imported into your python script wherever necessary. procedure TForm1.PythonModule1Initialization(Sender: TObject); begin // In a module initialization, we just need to add our // new methods with Sender as TPythonModule do begin AddDelphiMethod( ‘foo’, spam_foo, ‘foo’ ); AddDelphiMethod( ‘CreatePoint’, spam_CreatePoint, ‘function CreatePoint’+LF+ ‘Args: x, y’+LF+ ‘Result: a new Point object’ ); AddDelphiMethod( ‘getdouble’, spam_getdouble, ‘getdouble’ ); AddDelphiMethod( ‘getdouble2’, spam_getdouble2, ‘getdouble2’ ); end; end; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 procedure TForm1.PythonModule1Initialization(Sender: TObject); begin   // In a module initialization, we just need to add our   // new methods   with Sender as TPythonModule do     begin       AddDelphiMethod( ‘foo’,                        spam_foo,                        ‘foo’ );       AddDelphiMethod( ‘CreatePoint’,                        spam_CreatePoint,                        ‘function CreatePoint’+LF+                        ‘Args: x, y’+LF+                        ‘Result: a new […]

Read More

Learn How To Quickly Animate, Apply Image Effects, Transition Effect To Your Delphi And C++ FireMonkey Apps

Animation, Effects and Transition are the words applied mostly to the Film Industry and those days were gone. But these become the basic expectation from the customer for any Mobile, Desktop, Web Applications. A simple meme requires animations to convey a message more creatively. Will you miss to provide such a feature in your Delphi/C++ Application to wow your customers? This post will provide a quick overview of animation, Image Effects, Transition, and Direct how to do the same in FireMonkey Applications. Animation: Animations modify property values over time. They can be started automatically or manually, both with an optional delay. After the animation has run its course over the defined time period, it can stop, start over, or do the same but in reverse. Kinds of Animation : The provided subclasses of TAnimation fall into three categories: Interpolations from a start value to an end value: TIntAnimation changes any property that is an integer. TFloatAnimation changes any property that is a real number, like position (X, Y, and Z axes must be done separately), rotation, and opacity. TRectAnimation changes the location of the four edges of a TBounds property. TColorAnimation changes any string or integer property that contains a color, including those of type TAlphaColor (which is actually a Cardinal number), by modifying the red, green, blue, and alpha values of the color. TGradientAnimation changes a gradient (type TGradient) by modifying the colors of each point that defines the gradient. TBitmapAnimation transitions from a starting bitmap image to another by drawing the final image (type TBitmap) with increasing opacity, causing it to fade into view. Interpolating through a series of values, not just two: from the first to the second, from the second to the third, and so on: Stepping through a list without interpolation: TBitmapListAnimation works like a timed slideshow, with all images combined horizontally into a single bitmap. With a fast frame rate (short duration and/or many images), it looks like a movie. Animation Type Controls how Interpolations is applied(Start and End). Image Effects: The FireMonkey built-in ImageFX engine provides over 50 GPU-powered effects. These effects are nonvisual components that can be found in the Effects category on the Tool Palette. All the provided effects can be simply enabled or disabled by setting the Enabled flag from the Form Designer, or programmatically. To know More about the Kinds of effects Check here Transition Effects: FireMonkey includes over twenty image transition effects, in which source pixels are progressively transformed into a target bitmap image, from simple fades to fancy banded swirls. The progress of the transformation is deterministic and can be set to an arbitrary percentage. This percentage can be animated to transition over time. To animate the progress of the transformation, see Apply an Animation Effect to a Property of an Image Effect. I guess, You might got rough idea on Animation, Effects, Transition Effects. Watch this Video, Delphi Skill Sprint – Using Effects, Animations and Transitions on FireMonkey shown below for Demonstration. Check this video for more demonstration on the same topic which covers FMX TTabControl Transitions as well.

Read More

Quickly Learn How To Optimize Your Delphi Apps With ProDelphi In This CodeRage Replay

ProDelphi measures the runtime of Delphi programs. If a program is too slow, ProDelphi gives the necessary information to optimize it. The principle of source code instrumenting , a sophisticated  correction algorithm and the unique granularity of 1 CPU cycle guarantee to get correct measurement results . Other profilers only have a granularity of 1 ms or less. Source code instrumenting guarantees that always every part of an application is measured . Sampling profilers only give rough or even random measurement results, they can not determine the exact execution time of a procedure (see also profiler types ). To compare the granularity of ProDelphi with any other profiler, a profiler tester is supplied in the download area. Because of the outstanding low measurement overhead even time critical applications can be measured.Integration into the Delphi IDE, a call graph and a handy viewer guarantee a fast optimization process. ProDelphi can measure VCL, CLX and FMX (FireMonkey) applications. The video shows how fast you get the runtimes of all procedures. Head over and find out more information about ProDelphi and download it.

Read More

uniGUI Is A Compelling Web Application Framework For Delphi Based On Sencha Ext JS

FMSoft uniGUI is a web application framework for Delphi. This framework extends the web application development experience to a new dimension. uniGUI enables Delphi developers to create, design, and debug web applications in IDE using a unique set of visual components. This framework is close to the native VCL application development process which is RAD! The uniGUI web applications can be deployed to a server using one of the available deployment options such as Windows Service, Standalone Server, or ISAPI module. More about the uniGUI: It is based on the advanced Sencha Ext JS library. Includes an OEM license for Sencha Ext JS. Including advanced Stress Test Tool Supported many Delphi versions from Turbo Delphi Pro to 10.4 Sydney! Supports all the popular web browsers uniGUI HyperServer technology which is designed to improve availability, stability, and scalability of the web app. It turns into a multi-process multi-threaded model. So in this webinar, you can find out more information about the FMSoft uniGUI web application development framework! Be sure to watch the whole session to grasp real experience in developing web applications with your Delphi skills!

Read More

Powerful Multi-sensor Imaging Tool For Processing And Analyzing Hyperspectral Images Built In Delphi

ImageLab is a native Windows-based multi-sensor imaging tool for processing and analyzing hyperspectral images built in Delphi. It targets research in science and technology where spectrally resolved images are utilized. According to the developer “ImageLab provides multi-sensor support for hyperspectral imaging. This enables researchers to extract information from spectrally resolved images which cannot be obtained otherwise. ImageLab supports a long list of spectroscopic methods (i.e. uvvis, infrared, Raman, energy dispersive xray, THz, mass spectroscopy, and more) and is used in a broad range of applications (e.g. detecting particles in air, scanning tissue for cancer cells, uncovering ultrafine cracks in steel and more). Despite the sheer size of the application (approx. 750,000 lines of Delphi code) this new and unique application has been developed within 5 years from scratch (thanks to RAD Studio and the SDL Component Suite).” Website http://www.imagelab.at/ 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

Why C++Builder? Check Out The Advantages Of A C++ Developer On Windows

C++ has consistently dominated “Top Programming Languages” lists worldwide this year. With such a strong demand, C++ developers are well-positioned to experience a good problem: too much work. You can join the presenter and C++Builder Product Manager, David Millington, to explore the features and functionality that set C++Builder apart by helping C++ developers worldwide build stunning apps faster. Additionally, get an exclusive sneak peek into the powerful updates coming soon to C++Builder. David Millington is a long-time C++ and Delphi developer. Originally from Australia, he now lives in far north Europe, a decision he loves every summer when he has 22 hours of daylight, before deciding he’s crazy every winter with 22 hours of night. Since joining Embarcadero in 2016, he has worked as the senior product manager for C++, the RAD Studio IDE and debugger. Embarcadero tools are built for elite developers who build and maintain the world’s most critical applications. Our customers choose Embarcadero because we are the champion of developers, and we help them build more secure and scalable enterprise applications faster than any other tools on the market. In fact, ninety of the Fortune 100 and an active community of more than three million users worldwide have relied on Embarcadero’s award-winning products for over 30 years. In the tutorial below you see in more details about the advantages of the C++ builder. Not using C++Builder yet? Head over and download the free trial of C++Builder today!

Read More

Quickly Learn To Assign Value Between Delphi And Python Using Python4Delphi Sample App

Earlier in the Python4Delphi Demo 3 post, we have learned how to create a Python Delphi Variable using the TPythonDelphiVar component, assign some value to it, and showed the value as a string. You can also use Python4Delphi with C++Builder. This post will see some advanced usage of the TPythonDelphiVar component. You can also use Python4Delphi with C++Builder. Python4Delphi Demo4 Sample App shows how to assign a variable value between Delphi and Python using the TPythonDelphiVar component events. This can be achieved by events that set and gets data as a variant or python object. Internally this component converts a value from Delphi to python and vice versa. You can find the Demo4 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 Demo4 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. 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 Demo4 sample project from the extracted repository ..Python4DelphiDemosDemo04.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. procedure TForm1.PythonDelphiVar1GetData(Sender: TObject; var Data: Variant); begin Data := Edit1.Text; end; procedure TForm1.PythonDelphiVar1SetData(Sender: TObject; Data: Variant); begin Edit1.Text := Data; end; procedure TForm1.PythonDelphiVar1GetData(Sender: TObject;   var Data: Variant); begin   Data := Edit1.Text; end; procedure TForm1.PythonDelphiVar1SetData(Sender: TObject; Data: Variant); begin   Edit1.Text := Data; end; PythonDelphiVar2 component is intended for demonstrating how to get and set python objects using PythonDelphiVar2ExtGetData and PythonDelphiVar2ExtSetData events. A python object is created using the python script and assigned to PythonDelphiVar2 value. class C:   def __init__(Self, Arg):     Self.Arg = Arg   def __str__(Self):     return “

Read More

Powerful Native Open Source Hard Disk, Folder and Storage Analyzer Built In Delphi

Xinorbis is a very powerful hard disk, folder and storage analyzer available over on SourceForge. A good portion of it is open source and mainly written in Delphi. Other utilities included with it are written in C++ and C# which shows how easy it is into integrate Delphi and Object Pascal with other languages. According to the website “It uses a sophisticated mix of graphs, tables, and tree displays to give a complete, and unprecedented, picture of the contents of any hard disk, SSD, folder, removable or network drive. In fact, if your PC can see it, Xinorbis can scan it. Xinorbis makes it easy to see the contents, structure, file distribution, and file composition of any attached storage device. It includes fully customizable report generation in ASCII, CSV, HTML and XML.” As you can see it uses a Delphi style to implement a dark theme. Website https://sourceforge.net/projects/xinorbis-and-tools/ Screenshot Gallery

Read More

Quickly Build Powerful Python Modules In Delphi Using Python4Delphi Sample App

A Module is a file containing Python definitions and statements similar to the unit file in Delphi. To learn more about Python modules check this tutorial. How to create such Python Modules in Delphi using Python4Delphi components? This post will guide you. You can also use Python4Delphi with C++Builder. Python4Delphi Demo5 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 Demo5 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 Demo5 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. 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 Demo5 sample project from the extracted GitHub repository ..Python4DelphiDemosDemo05.dproj. Open this project in RAD Studio 10.4.1 and run the application. Implementation Details: PythonEngine1 component 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 using this InitScript. import sys print(“Python Dll: “, sys.version) print(sys.copyright) print() PythonGUIInputOutput1 component provides a conduit for routing input and output between the Graphical User Interface (GUI) and the currentlyexecuting Python script. PythonModule1 with Module name spam is created. During PythonModule1Initialization a method spam_foo is added to the Module. And the definition of the method is included in the same unit file. Logically a python module is created and its methods were created using this PythonModule. Later this can be imported into your python script wherever necessary. function spam_foo( self, args : PPyObject ) : PPyObject; cdecl; begin with GetPythonEngine do begin ShowMessage( ‘args of foo: ‘+PyObjectAsString(args) ); Result := ReturnNone; end; end; procedure TForm1.PythonModule1Initialization(Sender: TObject); begin with Sender as TPythonModule do begin AddMethod( ‘foo’, spam_foo, ‘foo’ ); end; end; function spam_foo( self, args : PPyObject ) : PPyObject; cdecl; begin   with GetPythonEngine do     begin       ShowMessage( ‘args of foo: ‘+PyObjectAsString(args) );       Result := ReturnNone;     end; end; procedure TForm1.PythonModule1Initialization(Sender: TObject); begin   with Sender as TPythonModule do     begin       AddMethod( ‘foo’, spam_foo, ‘foo’ );     end; end; Memo1, used for providing the Python Script which imports spam (PythonModule1), accesses the method spam.foo and the method shows the output. Buttons to perform the execution, load script from, and save the script to file. On Clicking Execute Script Button the script import spam print (spam.foo(‘hello world’, 1)) is executed. Python4Delphi Demo5 Check some of the tutorials available for Python4Delphi here

Read More

Learn How To Create A RAD Server With “David I” Intersimone In Delphi And C++

Embarcadero’s RAD Server provides a turn-key application foundation for rapidly building and deploying services-based applications using Delphi and C++Builder. RAD Server supports the REST (Representational State Transfer) protocol with JSON (or XML) parameter passing and return results. You can publish APIs, manage users and devices that are connected to the RAD Server, capture analytics about the use and users of applications, connect to local and enterprise databases using the FireDAC components and connect with Internet of Things (IoT) devices. RAD Server also supports user authentication, push notifications, geolocation, and data storage. Throughout the RAD Server documentation, source code, and in this technical paper, you’ll see references to EMS (Enterprise Mobility Services). EMS was the original name for the product, technologies, components and wizards that are now included the RAD Server product. With RAD Server’s wizards, components, and tools you can quickly develop new middleware and backend applications or migrate your existing Delphi and C++Builder client/server applications to a RAD Server based application to run on a server or in the cloud. You can publish your endpoints for REST calls from desktop, mobile, console, web and other types of applications. RAD Server comes with a full set of tools, components, database connectivity and interfaces that you will rely upon in building your service applications. RAD Server applications can be deployed on top of Microsoft Windows IIS and Apache web servers, and you can deploy your Delphi-based services to Linux Intel 64-bit servers. Download the full eBook and then check out the video below. Join RAD Studio expert “David I” and learn how to rapidly design, build, debug and deploy services-based solutions using RAD Studio and RAD Server. Want to learn more? Check out more information about RAD Server over on the Embarcadero site.

Read More