CHARTEVENT_CLICK and CHARTEVENT_OBJECT_CLICK help needed

 

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? 

 

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;
   }


 

 
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) {

  ... 

Reason: