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.
@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 certainly do have single click enabled. And you are correct the click selects both a button and the HL below.
- This is a user's forum not Metaquotes.
- Can someone please advise where I send a Request for Support to Metaquotes. - MQL4 forum
- Get in touch with developers using Service Desk! - MQL5 forum
- Report it to the service desk. 'MQL5.community - User Memo' - an article about the algorithmic/automated trading in MetaTrader
- Report it to the Service Desk, not us users.
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
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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.