Download MetaTrader 5

CHARTEVENT_CLICK and CHARTEVENT_OBJECT_CLICK help needed

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

1. When I click on the chart, CHARTEVENT_CLICK fires, onClick() is launched

2. When I click on an object, CHARTEVENT_CLICK && CHARTEVENT_OBJECT_CLICK are fired, both onClick() and onObjectClick() are launched 


In case 2,
How can I stop onClick() from being launched? I cannot think of a solution.  

Anyone can help me? 

Mihai Ionescu
1485
Mihai Ionescu  

for others who might have this dilemma,

I found a workaround

 

after seeing one integer chart property, ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS) 

I put all buttons in indicator window,

and then checked the y coordinate of mouse

like this:

if (id==CHARTEVENT_CLICK && dparam > ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS)) {
      printf("skip click event, because it's not in main window");   
      return;
   }


 

Liping Wang
3702
Liping Wang  
ifmihai:

for others who might have this dilemma,

I found a workaround

 

after seeing one integer chart property, ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS) 

I put all buttons in indicator window,

and then checked the y coordinate of mouse

like this:


 

or use 

if(id==CHARTEVENT_OBJECT_CLICK) {

  ... 

To add comments, please log in or register