UMG Widget blueprint with bindable exposed properties?

Is it possible to support binding to an “expose on spawn” property defined in a UMG widget blueprint?

Example usage:
We have some generic skinned widgets in order to re-use style. For example, we have a simple widget that includes a styled button with a text label. We have an “expose on spawn” property to define the text label. We’d like to make that text bindable in other widgets that use this button widget as a component. Is that possible? Is there a better way to accomplish what we’re trying to do here?

Thanks!
Lauren

Have you tried:

  • Make a Text variable
  • Set Editable and Expose on Spawn to True
  • On your button/label (in the Designer tab) bind the Text property to the Text variable
  • Now when you create the widget in a BP, you will see that property exposed.

Does this help?

Hi,

We think this post contains useful information which we would like to share with our public UE4 community. With your approval, we would like to make a copy of this post on the public AnswerHub which includes the discussion but strips out your username and company name. Please let us know if you are okay with this.

Thanks!

Hi Zak!

Yup, I have done all of that. Now I want that exposed property to be bindable in other widgets that use my styled button as a component widget. Currently I can set it manually, but it would be nice to use the binding functionality, as we plan to use this kind of thing in many places.

Here is the Label inside my reusable, styled button widget:
![alt text][https://udn.unrealengine.com/storage/attachments/66278-labelwithinbuttonbp.png]

Here is a usage of that button. I’d like “Label Text” to be bindable.
![alt text][https://udn.unrealengine.com/storage/attachments/66279-buttonusage.png]

Okay, I think I see.

For performance reasons, you probably don’t want to use a bind unless you want to update the label on every frame. This seems like something you only want changed once (the moment you spawn the button).

So, I would take this approach:

In your Login Button (UserWidget) unbind LabelText. Make the TextBlock itself a variable so you can access it and set its Text property. In the Event Graph, make a really simple CustomEvent/Function kinda like this one:

66280-setlabel.png

In this example I didn’t do anything fancy to LabelText. It’s just a text variable, neither Editable nor Exposed.

Next, in your other fancy widget that is utilizing your Login Button (which is a variable), do something like this on Construct.

66291-spawnwidget.png

As you can infer, the Text at this stage is Editable and Exposed on Spawn.

Now, finally, when you actually spawn this new fancy widget, you’ll see this and can use it as you’d expect:

And when spawned, whatever you fed into the exposed variable pin will be the new label.

66293-hadokenresult.png

Best of all, it only has to fire this chain of sequences once, as opposed to every frame, which it would if using traditional binds.

Hope this helps!

Hi Ben,
Yes, it’s fine to post this on the public community site.

Zak,
Thanks for posting this! I haven’t had a change to run through it yet. We’ll post back to let you know how it goes. :slight_smile: