GH - overriding "Append Additional Component MenuItems" doesn't compile

rhino
unhandled

#1

The method AppendAdditionalComponentMenuItems doesn’t compile in ScriptComponent. Why not?

protected override void AppendAdditionalComponentMenuItems(System.Windows.Forms.ToolStripDropDown menu)
{
    ToolStripMenuItem item = Menu_AppendItem(menu, "blah, blah", ..., false, ...);
    item.ToolTipText = "When checked, blah, blah, blah.";
}

I get this message:

Error (CS0115): ‘Script_Instance.AppendAdditionalComponentMenuItems(System.Windows.Forms.ToolStripDropDown)’: no suitable method found to override (line 259)

// Rolf


(David Rutten) #2

Because the code inside the scriptcomponent doesn’t derive from GH_Component. That’s the script component itself, not the code it compiles and runs internally. You cannot change the menu of a component you did not write.