Grasshopper

algorithmic modeling for Rhino

Hi Everyone,

I am probably missing something very simple here:

I am overriding the GH_Param method AppendMenuItems to add my own custom menu items to my own GH_Param.

However when those menu items popup I do not know how to trigger a close event when the user clicks outside the menu item onto the Grasshopper canvas.

How do I trigger an event when a user clicks outside the menu?

Many thanks!

Views: 1706

Replies to This Discussion

That should happen automatically. What sort of menu items are you adding?

Hi David,

Thankyou for your reply, I am adding a ToolStripMenuItem within which I am adding another ToolStripMenu item in order to have a nested dropdown list like that seen in the figure below:

I've attached my code: see where I override AppendMenuItems

Attachments:

Hi David,

Do you have anymore input on this? I'm basically stuck until I work this out. Thanks!

You posted an abstract class, so I couldn't test with your code.

However made another parameter that overrides the menu and shows a list of cities. Maybe you can use this as a basis for your parameters?

Attachments:

David Many thanks its working very nicely.

How would I change the code so that I can select multiple items?

Do I need to override Menu_CustomMultiValueItem?

Thanks

Hi David,

I created my own code based of yours for multiple selection and have posted it here for all to see:

Attachments:

That's a problem because a standard menu will close as soon as you click on it once. To keep a menu open after a single click you'll need to actually insert a custom control into the menu (like I do with object names and colours and a few other things here and there).

However I'd say this is something that should not be a menu at this stage, it is becoming too complicated. You could for example use the menu to display a proper Form in which you can do all sorts of tricky UI stuff, like have city search, or maybe pick cities off of a map, or...

You're right thanks David.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service