Why does CreateWidget c++ version not behave the same as Create Class BP function?

Hey,
sorry to wake up this post from the dead.

I was also trying to replicate the “Create Widget” and “Add to Viewport” on code but still without success.
Can you give more information about how you did it?

[EDIT]
I did it now.
I’ve figured out how to do it by following an old tutorial.