Clicking a button without clicking the chart?

Back to topics list To post a new topic, please log in or register
avatar
62
nikolaygmt 2016.08.06 18:46
 

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.

avatar
62
nikolaygmt 2016.08.06 19:33 #
 
I guess I just need to disable "Select object by single mouse click". Not perfect solution, but a workaround.
avatar
12992
WHRoeder 2016.08.06 21:31 #
 
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.
avatar
62
nikolaygmt 2016.08.06 23:13 #
 

@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.

avatar
62
nikolaygmt 2016.08.06 23:24 #
 
I updated my answer with additional infos.
avatar
12992
WHRoeder 2016.08.07 15:02 #
 
  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.
Back to topics list  

To add comments, please log in or register