Making a crowdsourced project on Canvas - page 37

 
Алексей Барбашин:

From the above it can be understood that a structure element is a specific dialog control, it contains its own properties and can contain nested controls. The set of properties of such a universal control is limited only by the developer's imagination.

Of course, we can avoid the structure and describe the properties of controls in a multidimensional array, but it's not initially cost-effective because we need to clearly remember which index of some property is stored. And the array cannot contain heterogeneous data types. It turns out that the description of the control element in the procedural programming is only possible through the structures. That is, the structure element is a concrete control, i.e. the concrete object of the dialog with its properties.

In the standard library, there is a folder Generic in Include, which contains the CHashMap classthat implements the key-valueinterface.
A single object can have a set of values of any type. Although the map tree has a time-consuming runtime, it works pretty quickly.
Might even work for describing properties, should try in general.
Or use another class type from this library, which is more suitable for the task.

Документация по MQL5: Стандартная библиотека / Шаблонные коллекции данных
Документация по MQL5: Стандартная библиотека / Шаблонные коллекции данных
  • www.mql5.com
Библиотека содержит классы и интерфейсы для определения шаблонных коллекций, которые, в свою очередь, дают пользователю возможность создавать строго типизированные коллекции. Они обеспечивают большее удобство и высокую производительность работы с данными, чем обычные типизированные коллекции.
 

Read it again, i.e. you propose to store an array equal to an array of pixels, in order to store information in this array (in your case "which function number" should be used for processing). ?

 
Maxim Kuznetsov:

Then there will be the reverse - linking the interface to the chart. For example, to make a button that is strictly linked to the time and price.

A separate GUI can be written in no time - with all tables, tabs, menus and whistles. In C# or even BASIC. And inside the chart is a significant problem for external applications.

And then why tie the interface to the chart?
After all, you can get any data, such as timestamps and prices, directly from the relevant functions.

 
Alexandr Andreev:

Read it again, i.e. you propose to store an array equal to an array of pixels, in order to store information in this array (in your case "which function number" should be used for processing). ?

If you're asking me, I didn't suggest anything like that. I didn't suggest anything at all)). Just described my views a bit. You are free to disagree.

 
Реter Konow:

In principle, it is possible to generalise types. I came to the conclusion that nothing bad will happen, if the vast majority of object properties will be of int type. All other (double is practically absent in properties of graphical objects) abbreviated types I rejected for the sake of simplification. The memory "overrun" is so insignificant that there's no sense in thinking about it. Of course, we cannot go for such a sacrilege for the sake of professionalism))). But this is the 21st century and I'm not threatened by bonfires).

I made the names of objects as numbers, and put them in the general series of properties of objects.

The only place where I needed a different type of data was control parameters. There I created a second kernel, which stores parameters properties, and values themselves in type string, which I can easily reduce to anything (more precisely, to what is written in the properties of the parameter).

HINT: By "control element parameter" you mean the PARAMETER MANAGED by the control element.

It turns out that the global array, which contains all the controls and all their properties, has a dimension depth equal to the sum of all the various properties of the controls. That is, even if some properties of the control are not needed, these cells will still be in this array, as the array is always uniform.

What is surprising, however, is the uniformity of the array itself. In this regard, using a structure is more than justified, because in this case each of the properties can be described by its own type, including theunion.

Using structures really simplifies the storage of properties, you don't have to limit yourself to one type or give up anything. You don't have to deal with conversions from strings to other data types... A structure removes all these limitations from the beginning.

In addition to the properties and coordinates themselves, this global array should also store the element subordination system. If the Caption object in our drawing has changed, the buttons must also be redrawn, as they are located on the header field. So, if any "middle" control has changed, everything on it should be redrawn. Peter, how do you store object dependency structure?
 
Алексей Барбашин:

It turns out that the global array, which contains all the controls and all their properties, has a dimension depth equal to the sum of all the different properties of the controls. That is, even if some properties are not needed for an element, these cells will still be in this array, because the array is always uniform.

What is surprising, however, is the uniformity of the array itself. In this regard, using a structure is more than justified, because in this case each of the properties can be described by its own type, including theunion.

Using structures really simplifies the storage of properties, you don't have to limit yourself to one type or give up anything. You don't have to deal with conversions from strings to other data types... A structure removes all these limitations from the beginning.

The kernel is the matrix. It holds all the properties of objects.

You can choose your own method. But, over the years of gui, I have come to the conclusion that no other method will give a similarly powerful growth in the functionality of an evolving system. Maximum simplicity and efficiency is perfection.


 
Алексей Барбашин:

...Peter, how do you store object dependency structure?

If you mean coordinate dependencies, also in kernel.

I have a special handler for coordinate object dependencies. It works with all types of dependencies.
 
Roman:

And then why tie the interface to the chart?
After all, you can directly retrieve any data, the same timestamps and price, from the relevant functions.

to the fact that the application interface (what the user operates with) is not limited to a single window.

We are talking about trading, aren't we?

Well, the placement of interactive elements on the chart (and their binding) is almost impossible to solve by external means.

Again, external dialogs/forms are easy to draw. But inside a chart, elements without the specifics of the terminal and the specific chart are almost impossible to draw.

 
Реter Konow:
The core is the matrix. It contains all the properties of the objects.

You can choose your own method. But, over the years of gui, I have come to the conclusion that no other method will give a similarly powerful growth in the functionality of an evolving system. Maximum simplicity and efficiency is perfection.


Matrix is nested loops and nested loops are time. Imho, no sarcasm, just reasoning logically.

 

Peter, you get the following: the core consists of global matrix of element properties, global matrix of element values, global matrix of dependencies, global matrix of pictures...

If any more properties need to be added, then the dimensionality of the matrices is increased.

The properties are accessed strictly by indexes because cells do not have names.

At least field names can be accessed with a structure.

Peter, you are... giant...

I, for example, see it this way (simplified):

class CControl : public CObject

{

public:

        int ПозицияХ;

        int ПозицияY;

        int Длина;

        int Ширина;

        color ЦветОсновы;

        color ЦветБордюра;

        int ТолщинаБордюра;

}

A de facto "class" is a specific string in your global array, just with a more "human" face. Classes are designed to create their own data objects, with a set of understandable properties that can be accessed by name rather than index. A class is just a universal type constructor.

So, we create a basic control that contains the most common properties, which almost any control has.

You can create specialized objects based on it:

class CButton : public CControl 

{

public:

        string Заголовок;

        int Image[];

}

That is, each subsequent control type simply supplements the base type with the required properties.

And since, as I wrote earlier, the basic properties are stored in the base control, the traversal of "hitting" the cursor in the control is done by checking one data type: CControl. Having found the desired object, the program immediately has access to the properties of that object, since the program point is already in the object itself, just like in your loop the program is on the desired array line.