mouse click, hold and drag

 
I am looking for a way to detect if the user clicks 'somewhere' in the chart and drag or if he clicks on an object and drag the object.

In both cases I get the same event:

id CHARTEVENT_MOUSE_MOVE,   lparam 517, dparam 253,  sparam 1   (X,Y, left Mouse)

Does anyone have an idea?
 
Documentation on MQL5: Event Handling / OnChartEvent
Documentation on MQL5: Event Handling / OnChartEvent
  • www.mql5.com
OnChartEvent - Event Handling - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

Of course I know the documentation.Unfortunately there is nothing useful. Do you have an idea how I can solve my problem?

 
Willbur: I am looking for a way to detect if the user clicks 'somewhere' in the chart and drag or if he clicks on an object and drag the object.

Why? Just read the object's new position and handle.

 
William Roeder #:

Why? Just read the object's new position and handle.


I want to write a usable control for vertical zoom and scroll:

1. mouse click and drag in the price scale changes the zoom.

2. mouse click and drag in the chart scrolls the chart.

3. right mouse click in the price scale asks if you want to switch back to automatic.

This all works very well - but:

I have to distinguish whether the user clicks and drags in the chart - or - whether he clicks and drags on an object. 
In this case he wants to move the object in the chart and not the chart.

Both movements start with CHARTEVENT_MOUSE_MOVE, left button.

Means: I have to remember the coordinates of all selected objects and check if the user has clicked on an object. This is not nice.


 
 
Dominik Christian Egert #:
Find your solution here:


Hi Dominik

This is not the solution, but a way to program my workaround.  Thanks
 
That's what I was referring to.