I have implemented custom drop down lists for my components using GH_ComponentAttributes
(image below). The problem is that the RespondToMouseDown
callback only fires when the mouse is clicked when on top of the component, while when the list is open the options appear beyond the layout bounds of the component.
To register the mouse events, I have therefore skipped RespondToMouseDown
altogether and I am using ActiveCanvas
events like so:
if (Grasshopper.Instances.ActiveCanvas != null) {
Grasshopper.Instances.ActiveCanvas.MouseMove += mouseMoved;
Grasshopper.Instances.ActiveCanvas.MouseDown += mouseDown;
}
The issue I am facing with this approach is that the callback functions for these events do not have a way to notify Grasshopper that the mouse event was handled elsewhere. Therefore, the clicks are handled by me and are also handled by Grasshopper itself leading to, for example, dragging the component.
The RespondToMouseDown
callback function has a GH_ObjectResponse
return type which allows you to inform Grasshopper that the click was handled so it won’t bother handling it as well. The ActiveCanvas
events do not have such a mechanism. Is there a way to go around that?