📜 ⬆️ ⬇️

A few tips to help make mobile development more comfortable

In the previous parts of the cycle on creating applications on the FM platform (FireMonkey), we learned about the basic techniques and techniques that allow us to create both desktop and mobile FM applications. And today, we digress a bit from creating a demo application, and touch on some of the distinctive features of the development process using the FM platform. Or rather, we want to give a few tips (both practical and conceptual) that may make the development process more comfortable.

An experienced developer can simply get acquainted with this material, while a beginner can find such information very useful. Let's start with practical recommendations.

Make more use of the Structure Objects window

')
FireMonkey forms are somewhat different from their VCL counterparts in their organization. The FM components have the parent property, and, accordingly, the positions of the objects are not attached to the form itself, but directly to the parent object (in this case, the parent has nothing to do with class inheritance). Therefore, seeing which component is “attached” to the object and, if necessary, “linking” it to another object is often simpler in the structure window than directly in the form editor. This is especially true for 3D applications that use a three-dimensional coordinate system.

Make more use of the Structure Objects window

Rename automatically created objects.


This board is generalized. He, of course, should follow when writing VCL applications. After all, the code becomes more readable and easier. But for the “Platform FM» (FireMonkey), where LiveBinding technology is actively used, this is especially important. After all, this automatically creates a lot of auxiliary objects, with the purpose of which then you have to deal separately.

Use layers when working with LiveBinding Designer


Of course, LiveBinding Designer is an indispensable tool that greatly simplifies the life of developers when using object binding technology. But, if we are talking about a fairly complex application, the number of objects that need to be linked will also be large. And these objects will be quite difficult to organically place in a limited space LiveBinding Designer. This is where layers come to the rescue. Having selected the necessary objects, you can simply transfer them to another layer using the context menu (Add to New Layer). Accordingly, in the new layer all the “extra” objects will no longer be visible. And you can switch between layers using the drop-down list in the upper right part of the LiveBinding designer.

Use layers when working with LiveBinding Designer

Make more use of the advanced features of LiveBinding Designer.


Working with a large number of objects in the LiveBinding designer can be a daunting task. But additional funds will help you quickly get started and more efficiently LiveBinding Designer. On the left side panel there are buttons responsible for scaling the diagram. In addition, it is possible to automatically arrange objects on the diagram in the most convenient way (Rearrange). If binding objects causes you difficulty, you can use the LiveBinding Wizard ...
In addition, in the context menu there is a very useful Show / Hide Elements ... item, which allows you to make objects that are not needed at the moment invisible.

Use styles


Visual FireMonkey components are quite different from VCL components. First of all, through the use of styles. The styles here not only change the appearance of the component, but also affect its behavior. To begin with, it is not necessary to try to take the first available components and begin to “pile up” the constructions in design time. Examine the various components. Try TButton, then TSpeedButton. In the "object inspector" find the StyleLookup property, use the drop-down list to select various options for the component style. Then see how its appearance and behavior change in runtime.

You should not grasp the TPanel and “classic Delphic ways” to try to “paint” it with the help of additional images and the TImage component. If you want to create top and bottom panels, then use TToolBar, paying attention to the fact that using the StyleLookup property you can get “upper” and “lower variants”.

The basis of the general-purpose mobile application interface is TListBox. Use the right mouse button to add a few items. For each specific element you can also set your own “style”. Experiment with different styles, paying attention to the ItemData property group with the style of the “listboxitembottomdetail” element (see the figure below).

Use styles

Use styles

Before you start an independent "creativity", try to use what has already been implemented using the mechanisms of styles in the "Platform FM» (FireMonkey).

And a few conceptual tips

When creating mobile applications, try to use standard controls for the platform.


Delphi is a tool with versatile and extensive interface design capabilities. And if it provides the ability to use the Grid in mobile applications, this does not mean that you need to do it. After all, the same Android interface does not imply the use of the Grid in the form in which it exists in "desktop" applications. As we could see from the example of one fairly well-known operating system, an attempt to make a common GUI standard for desktop and mobile platforms suffered a crushing fiasco. Leave the right to make mistakes to the powerful, create GUIs that are typical for the platform on which they will be used.

Do not try to completely copy the logic of the "desktop" application in the mobile version


This characteristic error of novice mobile application developers with the experience of "desktop" development has been repeatedly described. However, we could not fail to mention her here. Mobile devices, for all the dynamism of their development, are still inferior both in performance and screen size to stationary PCs. Therefore, it is very difficult to put all the logic of the “desktop” analogue into a mobile application, and it is completely unnecessary. After all, there are things that are more convenient to do on the tablet, but there are tasks that can be solved only on the computer at the table. And this needs to be understood when creating mobile clients of existing applications.

Design your application correctly. Separate logic from interface


The advice is not new and rather universal. But when creating mobile applications, more than ever, you can be sure of its relevance. The concept of development from Embarcadero involves the use of a single code base in different, in fact, applications. And if the code is properly organized, it can be used almost unchanged in both mobile and desktop applications. In this case, only that part of the program that is responsible for the user interface changes. The use of a common data module in our demonstration program is a good example.

Optimize code


Of course, this should be done in any applications. But, as we noted above, mobile devices do not have the same hardware capabilities as stationary PCs. Therefore, saving resources by the application is of particular importance. Create objects when they are needed, use dynamic form creation, etc.

Use additional IDE tools.


The latest versions of Delphi IDE include quite a few additional third-party tools, the use of which can significantly increase the productivity of developers. Unfortunately, not everyone knows about them and uses them effectively. Here we provide only a short list of such tools.

  1. Beyond Compare Lite - an effective means of comparing code;
  2. QA Metrics and QA Audit - code quality controls;
  3. CodeSite Logging is a powerful logging tool;
  4. Documentation Insight Express is a documentation tool.

Source: https://habr.com/ru/post/205194/


All Articles