x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How can I update Text on Text Widget?

How can I update the text on the text widget? Lets say I want to do so when a button is pressed on the UI. Right now I have a simple button, and I want to use the on clicked event to trigger the creation of a text widget, and I want to be able to set that text when it is created.

Product Version: UE 4.13
Tags:
more ▼

asked Oct 13 '16 at 05:35 PM in Blueprint Scripting

avatar image

Thumper
956 136 147 385

avatar image RuBa1987 Oct 13 '16 at 05:50 PM

Bind the text to a function or a variable and update that variable to change the text.

Right next to the little box you write the text in there is a button that should say "Bind". Just click that and set everything up. Then in your OnClick event set the variable to the new text

avatar image Thumper Oct 13 '16 at 05:59 PM

I've found that, but it seems oddly worded. Inside the function that I'm binding It says "get", and it only has a single slot for returning a value. No where do I see the actual variable for that text. Then when I try and find this inside a different widget (the button widget) I cannot find it. alt text

umg_01.jpg (206.6 kB)
avatar image Sean L ♦♦ STAFF Oct 13 '16 at 06:09 PM

You'll have to create the variable yourself and plug it into the function. Once you plug your text variable into the function, you can then edit that variable anywhere, meaning you won't need to make any changes to the function itself, just the variable.

avatar image Thumper Oct 13 '16 at 06:18 PM

I posted below a screen grab showing a version with the variable "Temp Text" created in the bound function. Outside in another widget called "Noise Menu" I try to create this "layerText" widget which should have the "TempText" variable. But when I use "Create Layer Text Widget" the return value doesn't give me access to that variable "Temp Text".

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Hey Thumper,

In your widget containing your text, you'll need to create a binding.

To do so, click the Bind button in the Content tab of the details panel when you have your Text selected and select Create Binding.

This will open up a GetText_0 function, which you can use to pass in whatever text you'd like. You can create a text variable, an array of text and get random messages, make literal text, etc to populate the Return Value. This is what your text will be when you spawn your widget.

Then, on clicked, you'll create your widget and it should get the text you pass into your get text function.

After this, you can update that variable any time at runtime to update the text that is displayed on your widget.

Let me know if you have any further questions regarding this setup and I'll be glad to help.

Have a great day

more ▼

answered Oct 13 '16 at 05:57 PM

avatar image

Sean L ♦♦ STAFF
43.9k 485 150 439

avatar image Thumper Oct 13 '16 at 06:09 PM

So I'm not seeing anything when I "create widget" node inside my button on clicked event. I would expect to see the variable "Temp Text somewhere and I could set that text, and then the "bound" function would feed this into the text variable of the text. alt text

umg_02.jpg (227.5 kB)
avatar image Thumper Oct 13 '16 at 06:12 PM

So far what I see happening is that I can have the Widget Layer Text spawn when I click the button, but it only displays what I put there inside the layer widget. I'm trying to access that text and change it. For instance, each time I click the button I want the text to read Layer 1, layer 2, layer 3, etc....

avatar image Thumper Oct 13 '16 at 06:20 PM

I was forgetting to make the variable in the "variable" section, instead I was making it in the local variable section

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question