> For the complete documentation index, see [llms.txt](https://docs.flatredball.com/flatredball/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flatredball.com/flatredball/api/glue-plugin-api/flatredball-glue/plugins/flatredball-glue-interfaces-imenustripplugin.md).

# flatredball-glue-interfaces-imenustripplugin

### Introduction

An IMenuStripPlugin is a plugin that adds a menu strip item. ![GlueMenuStrip.png](https://951240982-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fye9Ufg3vzJxwX5Hk%2Fuploads%2Fgit-blob-b5a6946832822cc7052fb274c7d69ad1305a2856%2Fmigrated_media-GlueMenuStrip.png?alt=media) IMenuStripPlugins can create new top-level menus (such as a new menu to the right of "Glue View" in the image above) or can add items under existing menu items (such as under the "Project" menu item).

### Code Example

The following code example adds an option under the "Plugins" menu option which shows a simple message box when clicked.

```
using FlatRedBall.Glue.Plugins.Interfaces;
using System.ComponentModel.Composition;
using System.Windows.Forms;

// Make sure your plugin class inherits from IMenuStripPlugin and exports the IMenuStripPlugin interface:
[Export(typeof(IMenuStripPlugin)) ]
public class TortoiseMenuItems : IMenuStripPlugin
{
    ToolStripMenuItem mMenuItem;
    MenuStrip mMenuStrip;

    public void InitializeMenu(System.Windows.Forms.MenuStrip menuStrip)
    {
        mMenuStrip = menuStrip;

        mMenuItem = new ToolStripMenuItem("Show Popup");
        ToolStripMenuItem itemToAddTo = GetItem("Plugins");

        itemToAddTo.DropDownItems.Add(mMenuItem);
        mMenuItem.Click += new EventHandler(mMenuItem_Click);
    }

    public bool ShutDown(PluginShutDownReason shutDownReason)
    {
        ToolStripMenuItem itemToAddTo = GetItem("Plugins");
        itemToAddTo.DropDownItems.Remove(mMenuItem);
        return true;
    }

    void mMenuItem_Click(object sender, EventArgs e)
    {
        MessageBox.Show("Popup!");
    }

    ToolStripMenuItem GetItem(string name)
    {
        foreach (ToolStripMenuItem item in mMenuStrip.Items)
        {
            if (item.Text == name)
            {
                return item;
            }
        }
        return null;
    }

    // The following methods are all required for plugins:
    public string FriendlyName
    {
        get { return "MessageBox showing plugin"; }
    }

    public Version Version
    {
        get { return new Version(); }
    }

    public void StartUp()
    {
        // do nothing
    }

    public bool ShutDown(PluginShutDownReason shutDownReason)
    {
        // This plugin needs to be responsible and remove itself from Glue when shutting down
        ToolStripMenuItem itemToRemoveFrom = GetItem("Plugins");
        itemToRemoveFrom.DropDownItems.Remove(mMenuItem);
        return true;// We are okay to shut down
    }

}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flatredball.com/flatredball/api/glue-plugin-api/flatredball-glue/plugins/flatredball-glue-interfaces-imenustripplugin.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
