ETO > GH_Component context menu (right click)

Hi Mcneel peeps (cc @curtisw )

In the GH_Component class we can override AppendAdditionalMenuItems and AppendAdditionalComponentMenuItems to add more context menu / right click items.

This requires the System.Windows.Forms.ToolStripMenuItem class. How does that work on a mac environment, and how does it work as everything is migrating to Eto?

Hey @sonderskovmathias,

We maintain our own copy of System.Windows.Forms and System.Drawing on Mac that implement all the APIs we need for Grasshopper. So you should be able to use existing Windows Forms APIs for these scenarios. If you have a Dialog/Form to show, it is recommended to use Eto as the Windows Forms layout system is not very well flushed out (though it sort of works for very simple cases).

To put Windows Forms controls on Eto, there’s extension methods to wrap them in a compatible control in Grasshopper.EtoExtensions. We use this for a few of the System.Drawing based Grasshopper user controls in the dialogs on Mac.

Hope this helps!

1 Like