Real time panel in grasshopper?

I’ve made a little component that can help you achieve what you’re looking for:


As you can see you need to right-click on this component to edit the output text.
RealtimeTextBox.gha (8 KB)

Sourse Code:

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Grasshopper.Kernel;
using Rhino.Geometry;
namespace RealtimeTextBox
{
    public class RealtimeTextBoxComponent : GH_Component
    {
        public string text;
        public RealtimeTextBoxComponent()
          : base("RealtimeTextBox", "RTB",
              "RealtimeTextBox",
              "Params", "Input")
        {
        }
        protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
        {
        }
        protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
        {
            pManager.AddTextParameter("text", "text", "text", GH_ParamAccess.item);
        }
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            DA.SetData(0, text);
        }
        public override bool AppendMenuItems(ToolStripDropDown menu)
        {
            Menu_AppendTextItem(menu, text, Menu_KeyDown, Menu_TextChanged, true);
            return true;
        }
        private void Menu_TextChanged(object sender, string inputText)
        {
            text = inputText;
            ExpireSolution(true);
        }
        private void Menu_KeyDown(object sender, EventArgs e)
        {
        }
        protected override System.Drawing.Bitmap Icon
        {
            get
            {
                return Properties.Resources.Icon;
            }
        }
        public override Guid ComponentGuid
        {
            get { return new Guid("472d3975-b91a-42ea-91cc-22bde76ab832"); }
        }
    }
}

RealtimeTextBox.zip (28.6 KB)

11 Likes