Download MetaTrader 5

Why MT5 generates 2 events for clicking objects?

To add comments, please log in or register
Mihai Ionescu
1504
Mihai Ionescu  

From what I saw now (because my code doesn't work as expected anymore),

when clicking a button, MT5 generates event for clicking button, but generates also even for clicking chart. 

I don't see the point honestly.

Moreover, I don't know how to discriminate between the two.

I mean, I have to make discrimination between this cases:

1. when only click on chart, then do code1

2. when only click on some category of buttons, then do code2

If I click a button, case 1 will fire too. 

Right now I cannot think of a solution.

I really would need some help with this, because I'm quite confused.

Documentation on MQL5: Standard Constants, Enumerations and Structures / Chart Constants / Types of Chart Events
  • www.mql5.com
Standard Constants, Enumerations and Structures / Chart Constants / Types of Chart Events - Documentation on MQL5
Alexey Da
Moderator
6599
Alexey Da  

https://www.mql5.com/en/forum/53/page7/#comment_35346

If you click any object on the chart you will receive two events:CHARTEVENT_OBJECT_CLICK and CHARTEVENT_CLICK. It definitely helps GUI developers.
I don't know what exactly you are doing in your code, but you should correct event processing.

List of changes in MetaTrader 5 Client Terminal builds
  • www.mql5.com
See the "MQL5 Reference / Standard constants, enumerations and structures / Named constants / Other constants " section.
To add comments, please log in or register