Component info RespondToMouseMove method

Hi,

Is it possible to customise the info panel that appears when the RespondToMouseMove method runs? The appearance of this info panel for clusters contains lines including author and external reference location and an image. Is similar content possible to add for compiled nodes without adding this information to the component description?

Any help is highly appreciated. Best regards Audun Mathias Øvstebø

image

Moved to Grasshopper category

Yes you can modify the contents of the tooltip, probably by setting custom attributes. I can’t quite remember how it’s done and won’t be able to check until after my Silvester holiday ends.

However you won’t be able to do it for components that you didn’t compile. I’m not entirely sure if that’s what you were asking.

The idea was to override the RespondToMouseMove method through custom attributes for a node that I compile. I need to know what class to inherit from to create and view a custom tooltip window. No problem, I can wait, thanks!

Hi, did you find any code that could help me to solve this issue? :slight_smile:

If the setters of this class are enough for you


override this

Also see:

Perfect, thanks a lot, this should be enough to get me started :slight_smile:

I tried to do as you said but the tooltip does not change. I also tried to create a new point location before running the base function but the the tooltip location does not change.

The function below is a part of the custom attributes where other functions are running as intended. Do I need to change something else in the function below or in the custom attributes?

publicoverride void SetupTooltip(PointF point,GH_TooltipDisplayEventArgs e)
{
e.Text=“New text”;
base.SetupTooltip(point,e);
}

Call the base method before your changes.

Are you assigning your new attributes to the component in question?

You have to override the CreateAttributes() method on your compensation and assign a new instance to the m_attributes field of the base class.

Calling the base method first works great! Thanks Dani!

Yes, the attributes have been assigned to the component, thank you for the feedback David.

One final thing, the property Diagram in of the GH_TooltipDisplayEventArgs is a bitmap. The image used for clusters contains lines for author and company as shown below. Is it possible to create images in similar style through some class or method on the fly for compiled components?

image


You can learn how to draw a bitmap at runtime from google. Also check GH_GraphicsUtils or something like that in the gh lib for some nice graphics methods.