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"

Write string vertically or dynamically instantiate UI widget using Button Click event in UI widget?

I am trying to create a UI widget in unreal 4.7... What i want here is that when the player clicks on any of the button on right the text button on left gets updated as well. I tried to find a way so that i can dynamically create them on click of button but couldn't get something workable... I could use a single string also to store the string for representation if I could be able to represent it vertically. But that also seems not available. Please help me out!!

For Example: String: "FWD-10 BKD-10 LFT-90 RGT-90"

Should be represented as:





Note: I want it to happen right when the user clicks on the button.

alt text

Product Version: UE 4.7
capture12.png (63.5 kB)
more ▼

asked Jul 13 '15 at 11:24 AM in Blueprint Scripting

avatar image

6 7 6 10

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

CMIIW, but until I write this, the default engine can't create new class or object from blueprint, only pawning actor. So, you should use structure instead of using object as data structure. The only way to create new class or object is create it from C++ class. so you can create static function with object as it's parameter then call it from blueprint.

Same goes for your current problem. The solution I offer to you is, instead of using textbox in widget, you can use draw text in HUD. Look at the content example from learning and read this documentation: https://docs.unrealengine.com/latest/INT/Resources/ContentExamples/Blueprints_HUD/1_1/index.html

If you still insist with your way, then this is the way that I can suggest for you:

  1. Create 10 (or more, whatever you want) text in widget design

  2. Create an array with text as its variable types

  3. Add all the text in array (do it in order)

  4. Add event on mouse click from the button in widget graph

  5. Split the string using Parse Into Array function, not Spit function look at below link for documentation https://docs.unrealengine.com/latest/INT/BlueprintAPI/Utilities/String/index.html

  6. Make logic if the array from splitted string has length more than the available text, then it do nothing

  7. Otherwise, write to text using array of text created earlier, with the same index as array of string from splitted string

I hope it'll help you out

more ▼

answered Jul 14 '15 at 06:12 AM

avatar image

Zoelbastian Bach
1 4 2 2

avatar image sunnysuman758 Jul 14 '15 at 06:41 AM

I did it something like this. One of my friend suggested this way. What do you think?

alt text

capture1.png (127.8 kB)
avatar image Zoelbastian Bach Jul 14 '15 at 07:52 AM

That's great! That's something new for me too. Thanks for the share...

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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