Grasshopper

algorithmic modeling for Rhino

Is it possible?

Thank's!

Views: 779

Replies to This Discussion

Yep.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

I forgot you were specifically looking to add one to Help. But you can just iterate over all the top-level items (File, Edit, View, Display etc.) until you find Help, then insert something into the dropdown of Help.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Also note that you cannot do this before the document editor has been constructed. You'll need to wait until loading has finished before you can insert something into the menu.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thank you David, but

My GH plugin is based on GH_Component derived classes and IGH_GeometricGoo specialized implementations. I haven't any high-level class thats control the entire plugin.

How can notify my plugin loading is finish?

Thanks again 

I'm afraid there's no event you can subscribe to that tells you when the plugin has finished loading and -more importantly- when the document editor window has been constructed. You can take one of two approaches:

  1. Start a timer inside a GH_AssemblyPriority derived class (say, every second) and then just check to see if the Document editor exists (Grasshopper.Instances.DocumentEditor IsNot Nothing). Once it exists, kill your timer and insert the menu.
  2. Wait for some other function pertaining to your components. For example watch out for calls to AddedToDocument() on GH_Component and then insert the menu. Downside is that the menu won't be there until someone uses one of your components for the first time.

I'd go with 1.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

The Timer option (started in GH_PersistentParam<T>::Icon::get) works fine.

I have try access to menu with

ToolStripMenuItem ^helpMenu;
helpMenu = Instances::DocumentEditor->mnuHelp;

but i can't. I have leaks with .NET Reflection, i do

System::Reflection::PropertyInfo ^pInfo;
pInfo = Instances::DocumentEditor->GetType()->GetProperty("mnuHelp");

but pInfo is nullptr.

mnuHelp is internal and cannot be accessed from outside of Grasshopper.dll (well, it can, but only through reflection). You should get the DocumentEditor->MainMenuStrip and then iterate over the items in this strip to find mnuHelp.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Ok, I have it

Thank you David

I'll add proper events for menu creation in GH2 and also better ways to insert menu items into the main menu.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service