Trigger Component Resize


I developped a component which change input names depending on what it’s connected to. I’d like to redraw and resize the component when a change occurs, ideally without triggering the recomputation.

I’m using OnDisplayExpired(true) method, it renames inputs perfectly but doesn’t resize the component according to the new names. Kindly have a look to the screenshot below. The redraw occurs only when you click somewhere else on the Canvas.

Any idea?


You’ll have to expire the layout of the component attributes if you want it to recompute the size and positioning of subobjects.

this.Attributes.PerformLayout(); // You probably do not need to call this as it should happen automatically.

Thanks for this quick answer @DavidRutten, it works perfectly. My understanding of Grasshopper GUI architecture is still a bit weak :slight_smile:

The Grasshopper GUI architecture is not exactly easy to understand. It’s a bit of a mess.