Noutați

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

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

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