Grasshopper

algorithmic modeling for Rhino

Hello community,

I'm trying to create a component which allows me to modify the controlpoints of a surface. Therefore I made a custom "GH_ComponentAttributes"-class.

In this class I was overriding the "RespondtoMouseDown" - method to handle my  

mouse-interaction. This works perfectly for anything inside my native component bounds .

However, my layout is a bit untypical. And now I cannot increase the bounding's for my mouse handling.

Are there any chances to solve that problem? If so how can I do this?

I have two ideas which are actually a bit difficult to realise.

1. Create a custom resizable component like the  Display matrix component.

    But I don't know how to do this. Has somebody experience with that?

2. Using "user32.dll" and asking for any click that is in bounds of the buttons screen location, but this seems a bit to hacky.

 

Views: 1121

Replies to This Discussion

Please please please don't use option #2.

What you need to do is make sure that the bounds of your attributes include your matrix UI. This means you'll either have to draw the component capsule yourself, or, just before you call the base attributes to draw the capsule you change the bounds to just the component, and then change it back right afterwards.

Unfortunately component attributes are rather complicated objects so recreating them from scratch will be both difficult and a waste of time. If you don't particularly need the functionality provided by component attributes (ie. you don't care if people can rename input and output parameter, you don't want to show the modifier icons on inputs and outputs, etc.) then you can come up with custom attributes, even resizeable ones. However note that almost all objects in Grasshopper that have special attributes are always parameters, not components. The only exceptions are Gradient and Legend and there's good reason for that, changing the way components look and react is too bloody difficult by half.

I can have a look to see if I can come up with an example for drawing components with extra stuff around the periphery.

Here. Additional box included in component, mouse events, layout and render methods overridden but using all base class functionality whenever possible.

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service