How to lock the mouse in a widget?

Hi,

Is anyone know how to lock the mouse cursor inside a specific widget through blueprint? The only node that seam to be made for that is Lock Mouse but I can’t understand how to use it.

Thanks,

By lock mouse you mean to restrict mouse movement within a specific widget? Something like this:

The button flips a boolean value:

219275-lockbutton.png

The overriden MouseMove keeps the cursor locked within the widget bounds based on the state of the bool set by the button above:

3 Likes

This is exactly what I wanted to do, thank you very much!

Consider flagging it as answered. Helps others find the answer quicker! And good luck.

I have a situation where my widget is fullscreen (using a background blur) and there is another border component inside it with smaller dimensions.
I tried to use the lock mouse example above in the overriden MouseMove event bound to the border but the mouse does not stay in bounds. I am using ue 4.21.
Is there something wrong?