Clicking a button without clicking the chart?

 

When I click on a (standard/normal/OBJ_BUTTON) button, if the click is at or near a horizontal line, the line will be selected too (because the option "Select object by single mouse click" is activated), which is undesireable for me.

How can I make it so that only the button is clicked and NOT other objects on the chart?

I tried to set the OBJPROP_ZORDER to high values from 10 to 1000000, but there is no effect. The OnChartEvent correctly detects the button object being clicked.

 
I guess I just need to disable "Select object by single mouse click". Not perfect solution, but a workaround.
 
nikolaygmt: When I click on a (standard/normal/OBJ_BUTTON) button, if the click is at or near a horizontal line, the line will be selected too (because the option "Select object by single mouse click" is activated), which is undesireable for me. How can I make it so that only the button is clicked and NOT other objects on the chart?

I tried to set the OBJPROP_ZORDER to high values from 10 to 1000000, but there is no effect. The OnChartEvent correctly detects the button object being clicked.

My GUI (Indicators: Money Manager Graphic Tool - MQL5.community traders' Forum - Page 5) just has a (non-selectable) box on top of the lines and buttons on top of that useing zorder 1-3. No problems.
 

@WHRoeder, I already tried you EA before posting, hoping you have found the anwer :) But it has the same problem when the option "Select object by single mouse click" is enabled. I assume you have disabled it and that's why you can't select horizontal lines beneath it by a single click.

In this case if you put HL beneath the 1,2,3,4 Ratio buttons and DOUBLE CLICK one of the buttons, you should be able to select the HL.

I noticed that when this option is enabled and one clickes on a button near/above an already selected horizontal line, an additional CHARTEVENT_CHART_CHANGE event is sent, which is not the case when the option is disabled. I thought I could change the selected state of the object back to its previous state, but I could not find a way to get the object given the X and Y coordinates delivered by the CHARTEVENT_CHART_CHANGE event.

 
I updated my answer with additional infos.
 
  1. I certainly do have single click enabled. And you are correct the click selects both a button and the HL below.
  2. This is a user's forum not Metaquotes.
 
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
  


      
        
  if ( id == CHARTEVENT_MOUSE_MOVE ) {
  
    int heightScreen=ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS,0);
  int widthScreen=ChartGetInteger(0,CHART_WIDTH_IN_PIXELS,0);
  
  //Print("POINT: "+(int)lparam,","+(int)dparam,","+(widthScreen-(int)lparam));
  
  if ( (widthScreen-(int)lparam) <= 300 && (int)dparam < 327 ) {
  ChartSetInteger(0,CHART_DRAG_TRADE_LEVELS,False);  
  } else {
  ChartSetInteger(0,CHART_DRAG_TRADE_LEVELS,True);  
  }
  

  
  }
  

OnInit add this code

ChartSetInteger(ChartID(),CHART_EVENT_MOUSE_MOVE,true);

Sample Control Panel coordinates

Reason: