Trigger Component Resize

unhandled

#1

Hello,

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?

image


(David Rutten) #2

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.ExpireLayout();
this.Attributes.PerformLayout(); // You probably do not need to call this as it should happen automatically.
this.OnDisplayExpired(true);

#3

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


(David Rutten) #4

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