Grasshopper

algorithmic modeling for Rhino

Hey people,

I want to add a menu-entry on the top-level of the main-menu-bar, where 'File', 'Edit' and so on is located.

Have done an intense search all over without success.
Would be nice if someone can give me hint.

Greets Mark

Views: 1109

Replies to This Discussion

There's no api for doing this. However once the editor window has been loaded you can access it via Grasshopper.Instances.DocumentEditor and then iterate over the controls until you find the main menu and start inserting items.

Do note that the editor will not yet exist while your plugin is being loaded, so you have to find some other place to run this code. Possibly you can start a timer from within your plugin load routine and check every second or so until the editor does exist.

hey david,

thanks for ur reply. Can u help me to find a function which is called during loading? So I can set up the timer there.
I tought such a function should be found as an virtual in "GH_AssemblyInfo" but there is none. I can not imagine other places.

"[...] and then iterate over the controls until you find the main menu and start inserting items."
Until now i can not search, but I wonder what I'm looking for. Is there a type called main-menu, or what kind of information should I look up?

Greets Mark

You can create a new class which inherits from GH_AssemblyPriority. As long as this class is public and has a public constructor with no arguments it will be loaded first and the PriorityLoad() method will be called. This would be a good place to start your timer.

Hey David, thanks for ur answer. It works like a charm...
But I would need ur help an other time:
I would like to populate the Menu from different plugins, but if I try to find the entry added from an other plugin it can not be found. In the end multiple entry with the same name appears. What can I do against this behaviour? I mean, I tried to add a delay on the second but without success...

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service