Grasshopper - Dropdown in a dropdown

I am trying to add a drop down to my component’s drop down so I can organise and arrange the inputs so things are easy to find. I can get it to compile, but I just can’t get it to show me the form. Any tips?

       System.Windows.Forms.Control control = new System.Windows.Forms.Control();
        System.Windows.Forms.ToolStripDropDown timber = new System.Windows.Forms.ToolStripDropDown();
        Grasshopper.Kernel.GH_DocumentObject.Menu_AppendCustomItem(timber, control);
        
        timber.Items.Add("one");
        timber.Items.Add("two");
        timber.Items.Add("three");

Hello, assuming you are developing a component with Visual Studio, there should be an overridable function like this.
public override void AppendAdditionalMenuItems(System.Windows.Forms.ToolStripDropDown menu)
{
base.AppendAdditionalMenuItems(menu);
Menu_AppendCustomItem(menu, myControlPanel);
Menu_AppendSeparator(menu);
}

Thanks for the response mikity_kogekoge - should have mentioned. This is taking place inside that function.

It just doesn’t result in a sub-drop down menu being attached to the ToolStripDropDownMenu

Hello, seems like “timber” is what you created. You need to attache your controls to the menu provided by your component instead of the one you created. The menu you created will be disposed in a millisecond. I think “timber” should be replaced by a System.Windows.Forms.ToolStripDropDown that comes down as an input of AppendAdditionalMenuItmes. ( which is System.Windows.Forms.ToolStripDropDown menu in my code)

Hi mikity, sorry to bother you again.
Still struggling to get it working - do you the lines of code you are talking about?.

I don’t think you can put toolstrips into menus.

You should call Menu_AppendItem(“timber”, ...), and then add your submenu items to the item which is returned from that method.

Menu_AppendItem return a ToolStripMenuItem object, how could i add items to ToolStripMenuItem?

Menu_AppendItem return a ToolStripMenuItem object, how could i add items to ToolStripMenuItem?