I’m wanting to bind data to my user interface vertical box. so that instead of filling in the spaces of a UI table with individual text boxes, it would fill in the space by using the contents of a data table.
How would I go about doing this?
Bind a widget property directly to the DT’s struct’s row member? No. But you could poll it every frame:
But this is an awful idea, wasteful and not too elegant. Instead, you could promote a row to a variable…
…and have a property poll that struct:
But wouldn’t it be simpler to just push in the data into the widget? Push in the struct via an exposed variable and you’re done. Properties can fetch what they need from the struct. You could even have the onInit / Construct do it so it happens only once rather all the time. Or call an event that sets pertinent fields - especially if the plan is to update them later on anyway.
Okay. So how would I just do what you described. Would be great to update the data or even gather data from an external source?
Data Tables are static - read only, one cannot update their content run-time. Instead, add their structs to a [Dictionary Map][1], now you have an editable version, just without the snazzy interface. You will need to Save your Game at some point anyway so this is pretty much a must if the plan is to go beyond anything very basic.
So how would I just do what you
described.
Which part? The custom event? It’s just this:
- whenever the data changes, call the event and pipe in a new struct. The widget can take it apart and set its own properties. Event driven approach is probably the most efficient way of updating the interface that does not need updating every frame.
even gather data from an external
source
Run-time? There’s an IO (File Utilities?) plugin that can do it (I think), or look at Rama’s Victory
plugin, it can fetch files from the drive. Also, look into [SQL][3] support for UE4 - probably the best option, a proper DB. But that will require some upfront setup, ofc. Or look at the Marketplace for SQL solutions, there’s probably a couple dozens by now.
Thanks I’ll look into it.