Draw an Object Using Click Event

 

I have an indicator with one button in corner of chart
And i want to click this button first,then click on the one of the chart bars and my indicator draw a simple line from that bar's date(and again when i clicking on that button , remove previous line and draw new with new given date )

the big problem is when i click on button it gets both CHARTEVENT_CLICK and CHARTEVENT_OBJECT_CLICK events and this makes very problems.
*** draw should be  available only when i pushed that button before(and not after drawing or before pushing)

anybody have solution to this problem? or another ways?

 
Graphical Interfaces III: Simple and Multi-Functional Buttons (Chapter 1)
Graphical Interfaces III: Simple and Multi-Functional Buttons (Chapter 1)
  • www.mql5.com
In the previous two parts of the series, we considered many topics concerning the development of the library structure for creating graphical interfaces and basic mechanisms for managing objects. In the second part of this series, an example of creating a control and connecting it with the library engine was considered in detail. That example...