We can no longer control the placement of objects on the graph "vertically"

 

The last, almost scandalous, discussion of the source code formatting problem ended with the developers acknowledging the programmer's "right" to write programs the way they want (not the way they think) and promising to finalize the source code formatting settings.

Now I've encountered a similar situation and again I want to ask the opinion of those for whom they develop MQL5.

Start here. In brief, the story is as follows: objects in MQL5 are placed in a chart in the order of their creation. The first object created is the lowest. If you accidentally delete it in the code or by a user, no other way to put it down will be possible (except to delete the remaining objects and recreate them in the correct order). The most obvious example: you've made a substrate to put texts, input fields and buttons on top of it. If you now delete it and create it, it will cover everything you'd like to see on top of it as the newest.

I've asked the Service Desk with a suggestion.

необходимо предусмотреть механизмы произвольной сортировки объектов "по вертикали". Либо наличием свойства Zorder у каждого объекта, либо функциями BringToFront, SendToBack, InFrontOf, BehindOf. Ну или хотябы сделайте так же как было в 4-ке - по имени объекта, т.к. к такому поведению объектов все уже привыкли и ожидают что в 5-ке будет также.

I got it right away at....

Anton Timofeev 2010.05.27 12:27
The current drawing sequence rule is simple and sufficient for drawing control. Sorting by name in some cases gives more flexible control over rendering sequence - simple solution for the specific task described in this forum (small drawback), but will force all users to carefully consider the name whenever they add an object (including non-MQL ones) (big drawback).
The rendering sequence at object overlay in MT5 is already used in practice (background, buttons, etc.). I have not complained about problems - everything is solved quite simply algorithmically.

who would have doubted that this is, so to speak, a "simple and sufficient rendering control" solution for them! :))))

to my comment:

ForexTools:

just because others have not complained does not mean there is no problem, maybe because no one has bothered with the interface ;)

replied


Hanging around:

https://www.mql5.com/ru/articles/64

https://www.mql5.com/ru/articles/65

https://www.mql5.com/ru/code/68

We have done a lot of internal testing, we have developed interfaces and games. There is no problem as such with the rendering order, just change your approach with the order in mind.

Good argument: the Ttris and Miner games were used to debug solutions for future trading interfaces :)))

And the bottom line is their verdict:

Above I've described the reason why we won't be making changes in quite some detail. I'll repeat in short: for the sake of convenience in a particular case, you can't make life harder for everyone else in all other cases.

If in F4 there was at least some order of chart objects location (by object names), in 5 we've made a self-drawn pack of cards and suggested that we "change our approach" to writing MQL5 programs.


TOTAL: what do fellow coders think? Do you need a mechanism for controlling object placement vertically? I've suggested three options:

1) old - by names of objects

2) normal - with adding Z-order property to each object of the chart

3) procedural - using functions BringToFront, SendToBack, InFrontOf, BehindOf

or accept the only option from the developers: in case of deletion, complete redrawing of all(!!!!) objects in the required order.

Who has any thoughts on this?


 
2)
 
I don't quite understand. In MT5, graphical objects are not arranged in depth by object name but by time of creation?
 
Integer >>:
Не совсем понял. В МТ5 графические объекты в глубину располагаются не по имени объекта а по времени создания?
Exactly! There's a simple script here to check
 

.

I'm for 2) or at least 1)

And the procedural one, who knows?


i also propose my own variant

all in favor of cascading stylesheets!!!!!

yeah your in mkl5 a lot of "great"

 

2)

if anything, that the order of objects is determined by the time of creation is only a disadvantage for the mapping.

unambiguously - this is an oversight and ignoring the problem on the part of meta-quotes.

After all, in the case of sorting by name, the programmer has at least some opportunity to sort at his discretion,

while with creation date even this possibility is gone.

You should return 1 or better make it 2. It just adds another convenient property to the object.

 

Of course for the Z-coordinate, it's in the spirit of OOP.
I'm for 2).

 
I am in favour of z-order/z-index
 

2) - Best choice.

 

1. One can, of course, discuss undocumented features. And this has been done many times. But in order to find solutions. Not to change undocumented behaviour.

2. We've had many more requests (more than participants in this discussion) to change the way objects are rendered. Yes, in Five we did a simple and natural order by object creation time (however, this is also undocumented). What do we do now?

3. We do nothing! Because with current sorting we can simply recreate a group of objects, which was impossible with sorting by name.

 

stringo писал(а) >>

As with the current sorting, you can simply recreate a group of objects, which was not possible with sorting by name.

Holding an object by the user with the mouse breaks the whole thing. Do you take this into account? Why was it impossible?
Reason: