hi
is it possible to / how would you add a widget as part of / to a parent widget in blueprint
e.g. add a button to a canvas panel in blueprint
thanks
hi
is it possible to / how would you add a widget as part of / to a parent widget in blueprint
e.g. add a button to a canvas panel in blueprint
thanks
thanks
for now did it in editor
but i think blueprint will be more efficient in this case
searched widget and all the other wrong places
not sure why they would hang it on game per se
i suppose they had good (some) reason
is it not the same node as used to create a widget from a widget blueprint?
seems it is
this is helpful
Both native and user widgets are widgets. But no, these are different nodes.
would you be able to use this approach to add buttons (with construct object) to a scrollbox
i see everything except add child to scrollbox
i also dont really see anything under scrollbox in the sense of add child
Some containers do not have a dedicated node - the scroll box does not, indeed. You can use the generic Add Child
which works with any panel. The downside is that you’d need to cast to the slot type if you do need the slot.
what would you use to add a textblock (text) to a button
i see add child (target = panel widget) works (at least in the editor)
but button is not really a panel
i see i forgot about the buttons needing clicked events
how do you add click events when you have created buttons in blueprints
found this
and hence button add event
but how do you do it for an array of buttons (number of buttons stored in an array)
should i use something like get hit under cursor perhaps
have not tried get hit under cursor for a widget yet
It will not work. There is a tracing method that works - the Widget Interaction Component
but that’s to interact with world space widgets when we have no mouse cursor - in VR or FPS where one points at things with their fancy controller or their, ehm, face instead… But I digress!
how do you add click events when you have created buttons in blueprints
Event Dispatchers. Buttons already come with the onClicked
delegate:
Now we have 10 buttons that all trigger this event, and this event can be in another blueprint - it’s a matter of hooking it up.
how do you do it for an array of buttons
Perhaps there’s no need and you can bind buttons as above as you create them. You can, ofc, add them to an array:
Or even make one manually:
But it may make little sense in many cases. You can also query containers for their children once they’ve been populated:
Most importantly, consider not using buttons for this, at least not on their own - it leads nowhere, you’ll get stuck very soon. At the very least wrap buttons with User Widgets:
Add a new
Event Dispatcher
, some Instance Editable
and Exposed on Spawn
variables and have the native onClick
call the dispatcher, piping in the data.
When you create custom buttons, use the usual Create Widget node, add them to the scroll box but instead of binding the mundane onClick
bind to your new Event Dispatcher:
As mentioned above, you can have any blueprint listen to the dispatches:
Here, each dynamically created user widget button that sits in the scrollbox will have the Game Mode spawn a unique unit.
But also give it a text block:
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.