Z-order meaning

 

A question for z-order.

I have a rectangle and within the rectangle an edit field. The rectangle should be moveable.

It is created with z-order 0. The edit field with z-order 1.


When i click into the edit, the rectangle moves sometimes, what should not be the case.

This seems to be the case, because every click in also have a mouse move dynamic, mostly.


I thougth setting the z-order to 1 makes clear, that the edit field is in focus and not the rectangle.


How can i keep the rectangle moveable (selectable == true) but then clicked into edit field and mouse

should move as well, the rectangle does not change position.


Thank you

 
when your objects overlap zorder will define which one will respond to a click event.
 
chinaski: When i click into the edit, the rectangle moves sometimes, what should not be the case.

I have the same problem with my GUI. Zorder doesn't work very good.

 

For reference:

z-order in MQL doesn't mean the order of graphical appearance, unlike HTML/CSS. It is selectable order related to mouse event. To give a visibility order, you have to create objects in the desired order. If you want to change the order, you have to re-create the object :)

https://www.mql5.com/en/docs/constants/objectconstants/enum_object_property#enum_object_property_integer

OBJPROP_ZORDER

Priority of a graphical object for receiving events of clicking on a chart (CHARTEVENT_CLICK). The default zero value is set when creating an object; the priority can be increased if necessary. When objects are placed one atop another, only one of them with the highest priority will receive the CHARTEVENT_CLICK event.

Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types
Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types
  • www.mql5.com
Object Types - Objects Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Ugur Catak #:

Para referência:

z-order em MQL não significa a ordem de aparência gráfica, ao contrário de HTML/CSS. É uma ordem selecionável relacionada ao evento do mouse. Para dar uma ordem de visibilidade, você tem que criar objetos na ordem desejada. Se você quiser alterar a ordem, você tem que recriar o objeto :)

https://www.mql5.com/en/docs/constants/objectconstants/enum_object_property#enum_object_property_integer

OBJPROP_ZORDER

Prioridade de um objeto gráfico para receber eventos de clique em um gráfico (CHARTEVENT_CLICK). O valor zero padrão é definido ao criar um objeto; a prioridade pode ser aumentada se necessário. Quando os objetos são colocados um em cima do outro, apenas um deles com a maior prioridade receberá o CHARTEVENT_CLICK evento.

But is there no way to define the appearance of the object without recreating it?

 
Yuri Evangelista Vargens #: But is there no way to define the appearance of the object without recreating it?

You don't need to recreate it. You only need to change the z-order by setting the OBJPROP_ZORDER property to the appropriate value (or any other property for that matter).