I am looking for a way to make a function which detects a LMB press when held over anything but a certain button.
You guys have definitely seen this function on your Windows desktop, where if you right click and bring up the menu, it disappears if any part of the screen other than the button is pressed with the left mouse button.
I need just that. Is there a way of doing this within Blueprint, e.g. If LMB is pressed and the button that’s in focus has not been pressed, bring the menu down, or would I have to somehow mark out an area over my main menu that covers the entire screen except the area of the tooltip menu and make it bring down the menu whenever it’s pressed?
I have can’t work anchors very well, the most I’ve ever gone in anchoring is stretching an element to all sides of its parent, and never touched any other options to choose from, so if possible, I would love to avoid anything to do with anchoring, to avoid a UI disaster, but if that’s the only way, then I’ll go with it. Anything to get this function going.
Probably just map out the location of the button in screen x/y coordonates and validate all clicks against the area where the button should be to ensure they do not line up.
You can get the mouse click and screen position off the mouse click action on any controller type blueprint as if it were any other input.
You can only get the position of the button if you know it, or of you cast to and query the correct values for it off the UI widget…
If you set things up smart, with anchors, you can predict that the button is always at X% of screen.
If you put it in a corner, then you can say
“All clicks >= 90x and 90y are on the button”.
Makes it a bit easier.
(You dont have to check that its also <= 95 to confirm its off the button to the right/lower corner for instance).
Definitely would.
Didn’t read the part where he wanted a context menu to close.
Of note: these functions don’t detect the click or worry about where the click is. They rely on the focus variable being set/reset like web browsers would.
You can manually re-create the same idea.
On each click set a variable to hold the object you clicked.
If the next click has a different object you know the focus was lost.