Download

Dynamic scaling of images within a widget

Hey there,

I’m trying to do something I’ve done many times before in other UI systems using just a few settings and checkboxes, but which does not seem to be anywhere near as easy with Unreal. Hoping someone can help.

I’ve got a widget which contains, essentially, a single image object (which it alters, though that’s not the point of this).

The problem is it’s a sub-widget, many copies of which I’ll put into a master widget. The problem is I want the image to automatically be the same size that each instance of it is set to.

So if I make one of them 32pt x 32pt, the image should lock itself to that size, ignoring uniformity.

If the one next to it is 64pt x 48pt, it should change to that.

Is there a way to (a) get the size of the current instance of a widget from within its blueprint code, and (b) change this when the object is rendered? I’m guessing in the case of this the Event Construct is best place for it?

Or, failing the above - is there a way I can simply lock an image object to always be the same size as its parent? In this case the canvas object of the widget in question?