Windows.  Viruses.  Laptops.  Internet.  Office.  Utilities.  Drivers

TRippleEffect class for creating an effect that applies wave ripples to the texture of visual objects.

The center of the ripple is specified in the property Center. Other aspects of the ripple can be customized using properties Amplitude (Amplitude), AspectRatio , And Phase (Phase). The number of ripple waves is determined by the property Frequency

(Frequency). The following table shows the results of the influence TRippleEffect The following table shows the results of the influence to a PNG photo placed on the form (using the ). The center of the ripple is in the middle of the image. Other properties are used with their default values ​​( = 0,1, (Amplitude), = 1,5, Amplitude = 70, , And = 0).

Frequency

In this tutorial you will use some basic image effects in the FireMonkey application.

Step 1: Apply the effect to the image.

    In FireMonkey, applying an image effect to an image is a simple process. Simply create a component that can contain an image and then apply one of the image effects. Create a new FireMonkey application ().

    File> New> FireMonkey Desktop Application> HD FireMonkey Application

Place the component on the form.

Select the component in the toolbar.

    Place the TImage on the form in the designer. You can see that the component does not fit in the center of the form designer. As shown in the figure, you want the size of the image area to be as large as possible. To do this, select the component on the design form, then change the properties Align V alClient

    in the Object Inspector so that the size of the component becomes the same as the client size of the form area. Select the image you want to apply the effect to. The component stores the picture in the property Bitmap . Select property Bitmap in the object inspector, and using Edit...

  1. to select an image. TRippleEffect.

Now you can choose an effect for the image. From the Tools palette, select Now RippleEffect displayed in in the window.

Structure To apply an effect, it must be defined as a child of another component. In this case, RippleEffect1 must be defined as a child Image1 To apply an effect, it must be defined as a child of another component. In this case,. To do this, drag must be defined as a child in the structure panel.

  1. Now you can see that Now already works on Form Designer.

  1. Change the property (Phase). The number of ripple waves is determined by the property on 20 .

Step 2: Apply animation effect to RippleEffect.

    Highlight Now on the panel Structure.

    Select a property , And in Object Inspector and run the command Create New TFloatAnimation from the dropdown menu.

Make sure that FloatAnimation1 defined as a child element To apply an effect, it must be defined as a child of another component. In this case,.

    Change properties FloatAnimation1 as below:

And finally, let’s add an event procedure OnMouseMove To .

FireMonkey is the core technology of the "new Delphi". Please tell us about the goals, capabilities and technical aspects of this fundamentally new library. After a while, looking back, how difficult and justified was your refusal to further develop the super-popular VCL?

It was chosen as the main direction for the development of Delphi technology to achieve a specific goal - multi-platform development from a single environment, based on a single source code base, without the need for radical retraining of developers. Within the framework of the now classic and super-popular VCL, this was impossible; its connection with WinAPI was too close, one might say, “at the genetic level.”

VCL components did not have an “abstract” layer between the functional level in terms of the interface and the mechanisms for displaying them. Functional level— how it behaves as a control, what events it reacts to, what kind of user interaction it provides. Display— calling platform-oriented visualization methods as a certain image formed by raster objects and vector primitives. FireMonkey initially implemented the principle of strictly dividing the control into two components: “behavioral” and “visual”.


Vsevolod Leonov, Embarcadero Technologies

The first one will generally repeat not even the basics of VCL, but the essence of object-oriented programming. A component is a class; component classes form a hierarchy where families and modules can be distinguished. The class of a component is loosely related to how it is rendered.

The visual “picture” is formed dynamically; it is not rigidly written in the component class. The image or "style" in FireMonkey is loaded into the component when the application starts. We have some kind of functional frame for the component, and the “skin” or “cladding” can be changed, but why? It is so that FireMonkey applications look authentic on any platform - Windows 7, Windows 8, Mac OS, iOS and, in the near future, Android. This is something that the traditional monolithic class structure of the VCL could not provide.

Here, the technological approach plays a special role. In principle, you can take the VCL library and “stuff it” with WinAPI and all other possible platform calls. This can still be done on a very limited subset of components, but the VCL contains several hundred components, so this approach could simply “kill” the VCL. It was decided not to touch VCL, but to develop new capabilities on a new platform - FireMonkey. This technology even has a certain technical elegance - at the time of assembling the project for a specific platform Delphi environment The IDE connects the required compiler, and the interface components receive a platform style.

For the user, this is one click of the mouse and the same source code; for Delphi, it is many years of hard work by developers to create such a multi-platform library.

When it became clear that FireMonkey would be introduced as a separate new platform, the right coexistence strategy had to be chosen: Embarcadero did not want to negatively impact VCL users in any way. Therefore, we have chosen the following plan: VCL remains ideologically and architecturally stable to ensure the highest possible compatibility, making it easier to migrate projects to modern versions. The development of FireMonkey will follow a natural and parallel path, without regard to the VCL.

The weak point of this solution is the rather problematic migration from VCL to FireMonkey within the same project. But for a new project, a developer can choose FireMonkey to ensure the multi-platform nature of their resulting application. After the release of XE4 with iOS support, we can already talk about the clear competitive advantages of Delphi for starting mobile development in a corporate environment, which will be increased after the implementation of the planned Android support.

Therefore, there is no obvious “refusal” from the development of VCL as such. In new versions, the VCL part of Delphi also develops. This includes 64-bit support, the introduction of styling for visual components, the implementation of a mechanism for flexible dynamic connections or “binding,” and the inclusion of the FireDAC library for working with databases in VCL projects. It’s just that, compared to the giant qualitative leap made by FireMonkey, progress in the VCL seems somewhat lackluster. But, be that as it may, VCL is an integral part of Delphi and will remain so for many years to come. Although the evolution of platforms and the current state of affairs in the field of OS for desktop systems and mobile devices are such that the future clearly belongs to FireMonkey.

In the interview we already discussed iOS support, let's tell our readers about the support of others latest technologies from the latest RAD Studio XE4, for example, such as Windows 8 and WinRT, 64-bit systems, MacOS and so on. Can you list what else you can offer to the modern programmer spoiled by innovations?

Most likely, a modern programmer is not “spoiled” by innovations. For large projects, any “innovation” often results in a gigantic amount of work.

For example, everyone waited a long time, many immediately rushed to transfer their codes to the new platform. But it turns out that even very professional teams are not ready for this. Compiling 64-bit code does not mean working. “Sins of youth” began to surface, for example, using instructions assuming a 4-byte address size. Lack of test culture, coupled with technological unreadiness to implement this process in a short time.

And here - the larger the project, measured, say, by the number of lines source code, the more careful and balanced the programmers are towards various kinds of innovations ranging from the appearance of a “button” in the interface to “syntactic sugar” in the compiler.

One of these “problematic” achievements was Windows exit 8. Personally, as a PC user and just a modern IT specialist, I am delighted with Windows 8. But for developers who were sent a batch of computers running Windows 8 with specifications for development under the new OS as a load, this means certain difficulties.

We tried to provide development support for the most comfortable and painless way possible. new interface this OS. Therefore, special styles have been introduced for both VCL and FireMonkey, and the programmer can either rebuild the application interface or create a new application that will be indistinguishable from the “native” one for Windows 8. appearance. Of course, there is a need for "native" Windows support 8 due to WinRT. But this is where the prioritization of goals in modern conditions comes into play. Mac OS, iOS, Android in the near future do not yet allow us to talk about full support for WinRT in the near future.

Embarcadero's strategic goal, of course, is multi-platform. The release of RAD Studio XE4 was key, primarily because iOS support. An existing programmer using VCL can start developing for iOS in a matter of hours. Even a simple mobile application can be instantly transformed into a powerful project that works within the existing infrastructure. Don't think that this is just a new compiler for FireMonkey and a new style to match the iOS interface.

This includes a new visual designer, built-in support for various form factors, data access libraries, including the new FireDAC, and LiveBindings technology for flexible and dynamic linking with corporate data. All these innovations arrive simultaneously - for Windows, Mac OS, and iOS. operating room Mac system The OS is not developing so rapidly, so there are no problems such as the transition from Windows 7 to Windows 8. But they appeared Retina displays, and this required special attention. Now any MacOS application created in Delphi XE4 automatically includes two styles - “normal” and “high definition”.

That. the same application can have the same high-quality “native” interface on any desktop computer from Apple.

Embarcadero does not want to “surprise,” “amaze,” or even “entertain” developers with its new innovative releases. Rather, on the contrary, the IT sphere is already full of various surprises: new devices, new platforms, new users, their new needs, new interaction scenarios. Add new software development technologies to this, and programmers simply will not have time to create new systems and existing ones - all they will do is migrate from one environment to another, from an old library to a new one, from one language to another.

But we do not profess rejection of everything new. We just want to ensure continuity of everything - code, interface, project, even professional skills when new platforms and devices appear. You could say that we are fighting unhealthy conservatism regarding new platforms through healthy conservatism in development tools. Don't expect exotic products, non-standard programming languages, or outlandish development tools from Embarcadero.

With us you will always find visual development, classical languages, “native” code, and let the target platforms for your applications, created in the same proven classical way, be new.

In the context of this blog, this project is primarily interesting because it is implemented on FireMonkey and is an amazing demonstration of the capabilities of this platform. And just last week, a public beta of the product was released. This way, blog readers can “feel” something truly complex for themselves. FireMonkey application.

A few words about the program. First of all, it should be noted that the current version of Sphere is positioned a little differently. Yes, sometimes it happens...

New SphereLive This is not just another messenger. First of all, it is a tool that allows you to effectively organize the educational process. It allows for remote lectures, private consultations, individual lessons and other similar activities. At the same time, it is equipped with almost everything necessary for work. Beginning with unique system file transfer and ending with the most powerful billing subsystem.

At this stage, prices for using the product are quite affordable. Subject to a limited number of listeners and a small amount of resources, the product can be used for free.

Naturally, the Sphere uses its main advantage FireMonkey– cross-platform. The application is currently available in Windows and MacOS editions. Android version expected any day now.

However, for me, SphereLive is interesting, first of all, as an innovative product with a whole set of original solutions. Sometimes it’s just at the level of “... wow, how did you do that?” By the way, one of the Sphere developers actively participates in discussions on the forum dedicated to FireMonkey. This in itself may be a reason to download the application and discuss technical issues directly with the author. Believe me, there is something to see and something to learn.

TListView is one of the key components for building a mobile application interface in FireMonkey. This component is not the easiest to use; it often requires a significant amount of code, but it provides the developer with significant freedom of action. Of course, in applications you can also use TListBox, where everything is much simpler. But TListBox may be good for displaying a fixed number of records, for outputting data from data sources, you should definitely use TListView.

The main differences between TListView and TListBox are:

  1. TListBoxItem- control, TListViewItem- No
  2. IN TListBoxItem you can add any controls using Parent. IN TListVIewItem- No.
  3. TListVIewItem stores only data for display
  4. TListVIewItem performs rendering of the stored data itself through the method Render
  5. Due to the actual manual drawing in TListVIewItem, an increase in speed and low memory consumption is achieved (storing only relevant data)
  6. To create your own version TListViewItem, you need to create your own item class, implement the required data in it (for example, time) and create an in-place editor for editing time, register it, etc.

The mere fact of increased performance and reduced memory consumption is a compelling argument in favor of using TListView. But there is something more.

In many Android applications I had to observe the following implementation of lists. When you click on a list element (Item, if you stick to the chosen terminology), a certain action is performed. Usually called new form to edit data. But when you press and hold (Long Tap), a completely different action is performed. And these events do not intersect. Others in Android's words applications can clearly distinguish between a “long press” and a “normal” one. Moreover, none of these events fire when scrolling the list. A good example is a list of letters in Yandex Mail.

First of all, I would like to congratulate all blog readers on the past holidays and wish them all the best in the coming year.

Due to obvious circumstances, I did not make a traditional New Year's report, nor did I make any plans for the year. However, life does not stand still, work is going on, and certain events are happening in the world of Delphi. I undertake to publish a selection of missed “news from the world of Delphi” during the Christmas holidays in the near future. In the meantime, I’ll tell you about the new device that I purchased.

You can find the characteristics on the official website. And the subjective impression is very pleasant. Noteworthy is the fact that the device is literally crammed with proprietary software from the manufacturer. And the sellers also received an impressive set of software as a gift. The smartphone is quite fast in operation and fully justifies its cost (about $200). By the way, I bought my previous phone GSmart 1362 for about the same money 2 years ago. But, as you probably guessed, the main interest for me was how they would work FireMonkey applications.

Before continuing the story about the timer, two pieces of news.

Firstly, the first XE7 update was released. By tradition, it is available to registered users. You can find a list of bugs fixed. I wanted to see how the application would behave in the updated environment. Actually, no corrections had to be made, although there was still room for experimentation.

Second news. Action special offers Embarcadero extended until the end of the year:

Well, now directly to the topic of the post. In principle, all that remains for us is to try to launch the already created this application for Android. To do this, we use what I wrote about in previous posts. Namely new. I debugged this application on Nexus 7, accordingly added a representation of Android 7″ Tablet. The design had to be tweaked only a little.

Probably only lazy people didn’t write their own timer. And in the context of supporting development for mobile platforms, the task of writing a timer in Delphi can generally be considered a cult task. So I thought, why not as an example of development FireMonkey The application cannot parse the timer. For Android, of course. Of course, this will be exactly my view of the task, which, although not particularly difficult, still has its own nuances. Perhaps you have any comments or suggestions, it would be great to discuss them in the comments. I'm by no means an expert in writing. mobile applications, so any comment you make will be valuable to me.

We will be developing a timer, in the English understanding of this term. That is, the screen will display a dial and four buttons - “Start”, “Pause”, “Stop” and “Cancel”. The countdown will be in the forward direction (i.e., the time will increase). The option in which the time is set and the countdown is in English terminology is called Stop Watch, maybe I will try to implement it later. The application we are going to work on is closer in functionality to a stopwatch.

Delphi XE7 allows us to significantly simplify the development process, due to the fact that we can now create and debug a real application for Win32, and then simply add form submissions for the necessary mobile devices and, with a little adjustment, get a working mobile application. Sounds too good to be true? Maybe. But I want to test this statement by implementing the task.

The more frequently I’m asked my colleagues in private conversations if it’s possible to develop mobile applications in FireMonkey or is it a prototype rather than a production solution?

I think, now I can ensure even the out-and-out skeptics.

My bosom friend and colleague Tagir Yumaguzin told me about the project he took part a long time ago. Now, when this project is in pre-release state, we decided that this description will be interesting for the Delphi community. In the essence, this is a really large project implemented in FM. We are talking about Sphere Live project. A little article devoted to that project was recently published in Habrahabr.ru Alexey Glyzin, chief of ‘ ‘ development department agreed to tell more about the project taking into consideration the audience of my blog.

A.B.– Alexey, in general, what is your project?

A.G.: – The idea has not appeared at once and instantly. Before the ‘Sphere’ project our team had been working on the project where stream audio/video technologies were implemented. Later we created our own software that was able to deliver multimedia streams to an unlimited amount of users including the feedback. But we needed to have a billing feature included.
The application had to comply with the several requirements. First, the maximally simplified organization of conferences or transmission to the participants which amount we cannot predict. Second, the most important, is to give to our clients an opportunity to earn with our application and to reduce the complexity of the system, amount of instruments needed to use to reach the goal. The ease of organization of courses, webinar or just a consultation.

A small note for memory concerning FireDAC Align current versionDelphi XE6. But first, a few words about where to look for answers to questions regarding FireMonkey. Russian-speaking users are in a privileged position here.

While preparing for the Kharkov event as part of the RAD Studio XE5 World Tour, I encountered a small problem in working with SQLite by using FireDAC. If filled in Windows application transfer the database along with the application to Android, Cyrillic strings in the database are no longer readable (question marks are displayed instead of letters). However, if you fill the database directly on mobile device, Russian characters are read quite correctly. Data from the database filled in third party application, or in Delphi applications using other data access components were also displayed normally. The meeting failed to find a solution, and I had to quote a famous Ukrainian football specialist: “We’ll figure it out!”

Unlike the last one, I was able to deal with the problem described. By default when connecting to SQLite Align FireDAC ANSI string format is used.

If you force Unicode to be installed, then everything will work as it should. But there is also an unpleasant moment. By changing the string format, you will have to recreate the list of fields in all data sets, as well as reconnect the components responsible for displaying and entering data. Therefore, it is better to take care of the encoding right away.

In the previous parts of this mini-series, we dealt with creating a database, its structure and connecting to it from Delphi. In this part, I propose to understand the display of data from tables, starting with the simplest case.

A simple table data editor, usually part of a complex application. I usually use a separate form to edit tables. Let's start with the grocery list. First of all, we need to create a DataSet to access the table data. In our case, it is quite possible to use the component TADTable. Let's place it in the DataModule and specify the property value Connection. In the property editor TableName a list of tables will appear from which we select a table Products. If you did everything correctly, you can assign the property Active True value. It is better to immediately rename the component (for example, ADTProduct). After this, I usually create a set of fields for the DataSet. Call the field editor (double click on the component) and context menu select the Add All Fields item.

For those who are not in the know, I will explain the essence of this operation. Here we create a predefined set of DataSet fields. If we don’t do this manually in design mode, then, in principle, nothing bad will happen. In RunTime this set will be created automatically. But I still prefer to create it manually. There are several reasons for this. Firstly, it’s more convenient to manage a set of fields, because we can create additional (calculated or lookUp) fields ourselves in design mode. We can also change the properties of the fields themselves. And in addition, we get the opportunity to access fields in code by the name of the TField component, which, in my opinion, greatly simplifies writing code.

As in the case of the VCL application, we will connect the component to the data set TDataSource. This component will provide the connection between the data set and the visual controls. The component's DataSet property must reference our data set (ADTProduct). Below I give a fragment DFM file

object ADTProduct: TADTable IndexFieldNames = "ID" Connection = ADConnection UpdateOptions. UpdateTableName = "Product" TableName = "Product" Left = 64 Top = 192 object ADTProductID: TADAutoIncField FieldName = "ID" Origin = "ID" ProviderFlags = [ pfInWhere, pfInKey] ReadOnly = True end object ADTProductTitle: TStringField FieldName = "Title" Origin = "Title" Size = 50 end object dsProduct: TDataSource DataSet = ADTProduct Left = 120 Top = 192 end

Please note one interesting feature: the DataModule form file is saved not in FMX format, like a regular FireMonkey form, but in DFM format, like in VCL.

The next step is to create a procedure for opening a data set, which we will need to call in RunTime when the program starts. Let's create it in the same DataModule. The procedure code is extremely simple:

procedure TDM. ConnectToDB ;

beginADConnection. Open();

ADTProduct. Open();


end ;

We will place the procedure call in the OnCreate event handler for the DataModule.

  • What is FireMonkey?

  • FireMonkey (FMX) is a framework for cross-platform development for both desktop systems (Windows, Mac OS + server support on Linux is planned in the near future) and mobile (iOS and Android) using the Delphi/C++ language.

  • the presence of a very advanced relative arrangement (20 types) of components on the form;

  • LiveBinding allows you to connect any type of data or information to any user interface or graphical objects;

  • presence of form/component styles;

  • Multi-Device Preview allows you to customize the visual presentation for each platform;

  • FireUI Live Preview - displays the appearance of the application on real devices in real time.

Possibilities:

  • use of the native API of each platform, as well as the ability to call third-party native libraries;

  • interaction with all sensors (GPS, Accelerometer, Compass, Bluetooth (including LE) and others);

  • support for push notifications, IoT;

  • support for asynchronous HTTP requests;

  • support for most databases (MsSQL, MySql, Oracle, PostgreSQL, MongoDB, etc.);

  • working with Cloud Service (Amazon, Azure);

  • Android Service support.

Cons (currently):

  • lack of support for customizing native classes;

  • implementation of specific things is either impossible (widgets, extensions (iOS), etc.) or a dance with a tambourine is required (background service, broadcast message, etc.);

  • Customization of the Splash screen (initial screen) is, to put it mildly, lacking;

  • FMX controls use their own rendering (visualization, drawing), which is purely visually similar to the native one;

  • the use of native controls involves large body movements;

  • when there is a lot of nesting of components, incredible things happen: the application crashes in various places, loses focus, freezes, etc.;

  • the information content of debugging an application on mobile platforms is zero;

  • descriptions of errors on mobile platforms are reduced to the useless “Error 0x00000Х”;

  • compilation time wants to be the best for medium and large projects;

  • the need to use a file to polish mobile applications for each platform;

  • no support for Intel Atom architecture;

  • inadequate price compared to competitors.

Pros:

  • very active development of both the product and the community lately, support for more and more new technologies;

  • the presence of a huge number of free and commercial components;

  • The speed of the application is very close to native;

  • very advanced visual editor and environment in general, the presence of styles;

  • the ability to test an application on Win, and only then deploy it on devices, which greatly speeds up development;

  • change mode/platform with a flick of the wrist;

  • PAServer provides easy interaction with MacOs when developing for Apple OS;

  • 3D graphics support out of the box.

In conclusion, FireMonkey has grown in size over the past couple of years. professional tool cross-platform business application development and more. Many shortcomings are gradually being resolved and with each release the product becomes more modern and self-sufficient, and the existing skepticism towards the Delphi language itself, associated with many years of stagnation, also disappears. Writing new projects in FireMonkey is “safe” and promising.

If you notice an error, select a piece of text and press Ctrl+Enter
SHARE: