I’m trying to make something quite simple, yet i can’t find any way to do so…
I want to be able to move the position of an UButton inside of my UserWidget in runtime via code.
Like, for example: I have my button in X(200)Y(200) and when I press another diferrent button (or the same, whatever) the SAME button moves to X(300)Y(300).
I can’t have two diferent buttons and make 1 visible and the other hidden cause I need to keep the OnClick event the same.
I’ve read the UButton doccumentation and there doesn’t even seems to exist a variable “position” or something like that.
The further I could get was this:
There is this variable called Slot which I guess is the position of the widget inside of the UserWidget (wild guess tbh), but I have no idea how to handle it.
I would like to make this in C++ but I dont even know how to do it in Blueprint so any kind of help would be apreciated (^_^)
Thanks in advance.
I’m still loking for the way to do this in C++ however I found the answer for blueprint method here: Dynamically set widget position on canvas panel?
I’ll post a picture of the blueprints nodes in case someone needs it, this nodes take the existing button (Button_165) and every time it’s clicked, move its own position to (x+100,y)
It’s just that the variable name “Slot” is already taken by your current class probably, name it something else. auto simply tells the compiler to infer the type based on context, in this case UCanvasPanelSlot*.