Detect object under mouse

Hi again

Is there a way to get the object(s) below the mouse cursor (or at a certain position x/y) ? I can’t seem to find a function… :confused:

Thanks! :slight_smile:

You need to do it manually.

Figure out where the mouse is (pick it up from either CHARTEVENT_CLICK or CHARTEVENT_OBJECT_CLICK or CHARTEVENT_MOUSE_MOVE)

Figure out where the object is (ObjectGetInteger).

See if the mouse x/y is within the object’s area.

Ok thanks. But what if it’s a line? o_O

Do you want to know if it has been clicked, or just hovering over the line?

If it has been clicked :X

void OnChartEvent(const int id, const long& lparam, const double& dparam, const string& sparam)
  {
   if(id==CHARTEVENT_OBJECT_CLICK && sparam==line_name) // line has been clicked
     {
     
     }
  } 

thank you, but the problem here is that the event is only triggered when the mouse button is released again. but i need it to register when the mouse button is only pressed but not released :confused:

You need to do it manually.

Figure out where the mouse is (pick it up from either CHARTEVENT_CLICK or CHARTEVENT_OBJECT_CLICK or CHARTEVENT_MOUSE_MOVE)

Figure out where the object is (ObjectGetInteger).

See if the mouse x/y is within the object’s area.