Real time panel in grasshopper?

unhandled
#1

Hello all,

when i search from a list by text match i need to hit all time OK to execute the panel input and get the result… is there a way to get a result while tiping without execute …like in a search engine or auto complete in a editor.
Otherwise searching is really comberson if you dont know the object names.

Newton's Method
#3

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)

9 Likes
#4

Perfekt…i Love it

#5

I tried your component and it was compiled for another version but thankfully you provided the hole project i could compile it for another version AND WOOPS HER IT IS…so nice to search in a rhino file for geometry objects and get a real time preview of the object and name…Thanks again

#6

Could you please upload the gha file here?

#7

RealtimeTextBox.gha (8 KB)

1 Like
(Thomas Evans) #9

Well done @Mahdiyar!, any chance to support for Rhino 5, I tested it and doesn’t appear.
@flokart what is the main difference of your compile version?

#10

Here I recompiled it for Rhino 5.14:


RealtimeTextBox(Rhino5.14).gha (8 KB)

3 Likes
(Thomas Evans) #11

thanks @Mahdiyar, just for curiosity what is that component?

#12

@ThomasE I’m pretty sure it’s this: False start toggle maybe not the ladybug one though…

Edit:
Hmm maybe it’s this one https://bitbucket.org/andheum/falsestarttoggle

1 Like
(Michael Pryor) #14

+1 for this!

#15

Is there any chance we use this component with a panel. I mean we type the word in a panel and search for it. It saves some clicks. Thanks Manoochehr