Mouse position doesn't get update when pressing down on UMG Button

This is a video showing the problem - YouTube. I think it’s part of how button works and i doubt it a bug. The current way around it is to set input to game and ui only but if i put that the “OnReleased” will trigger immediately after the “OnPressed” of the button even though i haven’t release my left mouse button yet.

Hello,

I’ve spent some time investigating this setup, and haven’t been able to come away with a solid solution. Could you explain exactly what you are trying to set up? It could be that this is not the best way to accomplish what you are looking to do.

I’m trying to hold the button with left mouse button and expand an inventory. I need the mouse position to know how far i moved my mouse from where i pressed it to know how much i should scale my inventory up by.

With the mouse position working the expansion and contraction of inventory looks like this - YouTube and it’s only working because i didn’t use the OnPressed but OnClicked but i want it to stop when i let go of the button. I think i could use something else instead of a button but i really like the button.

I’ve got it working on my end, here is how:

First, I created a new widget called Test that I want to use as my new mouse cursor. I added a Throbber component, and set it up as shown in the image below. The Throbber is just an example, so feel free to create an image to display whatever you’d like your cursor to be.

In the Graph of the Test widget, I pulled off of Event Tick’s My Geometry pin and added a Local to Viewport node. I promoted the Viewport Position to a variable that I named Mouse Pos. This will be your Mouse Position.

Next, go to Edit->Project Settings->User Interface and set your Default Cursor to whatever you’ve called your blueprint (I’ve called mine Test).

After this, I created a new Widget Blueprint that contained a button, and then set up my logic to print the mouse position of my Test widget (i.e. the mouse cursor).

After doing this, and adding my Button widget to the viewport, I was able to get the mouse position while still holding down the left mouse button on the Button widget.

Feel free to let me know if there are any questions.

Have a great day

Awesome this really worked. Searched all over the internet whole day for this solution. Finally got it. Though i hoped there will be a direct solution to this rather than such a round about solution :slight_smile:

worked for me, dont forget to unmark “Top Level Only”. By the way… learning this gave me the idea of instead of making the image I want follow the mouse cursor using event tick, just replacing the mouse cursor image, for the image from the buttom would be much more more cost efficient