On event double click not firing

EDIT: OnMouseButtonDoubleClicked Function override, not event, sorry.

So i posted this on the answer hub a few days back and haven’t really had anything in the way of help with it so far so thought i would ask here.

I am following a tutorial by UnrealGaimeDev here: [Eng] Slot-based Inventory System: Item Drag Preparation #011 - YouTube (00:00 - 02:26)

In the first part of this tutorial he creates a button and an “event on double clicked”

I have everything set up identically to his and have debugged the living day lights out of the blue prints but it seems to be an issue with the event actually firing.

The button style changes when i click but it doesn’t fire the event.

Is this a known bug?

I’ve found several people suffering with similar issues.

To recreate, just make a button in UMG and create an event override on double click that prints a string. the string wont fire (**** nearly given myself carpal tunnel clicking fast).

So far i’ve confirmed this in 4.16.3 and 4.17. Seems like a fairly major bug to still be in the engine after a major update so I’m questioning myself a bit.

From what i have read on other peoples posts it isn’t confined to double click either, others seem to be none-reactive as well.

Any feedback would be appreciated. Can post images of the blue prints if needed.

Thanks.

1 Like

Buttons do not have a double click event, and I don’t want to watch the tutorial. Can you give me the break down of what you’re doing?

Double Click is an actual event in Slate, when detected, you receive a double click paired with a mouse up, instead of a mouse down, up, mouse down, up. If you’re some how combining the double click detection on a UUserWidget with a button on top of it, I don’t know that will go well, since the SButton in Slate listens for and treats the double click event like a mouse down.

Sorry Nick, Been a long day and I’ve not been doing UE4 too long.

Your absolutely right, its OnMouseButtonDoubleClick function override in UMG, not an event.

You can see the blueprint I made here:

Basically all i want to do is when i double click the button (LMB) it fires off Use item at index (after checking conditions).

the widget consists of:

Size box
CanvasPanel
Button
image
Text

Another widget generates this widget X number of times dependent on the number of entries in an array.

let me know if you need more, or clarification, appreciate the help.

Dont Know if any of this helps or not but ill post it anyway.

The Slot widget:

f02af1f7cacd19cf27fc810be97cad24c28283e7.jpeg

and the event being called in the double click:

To reproduce the issue.

Create a new project. (im using top down template for this example)
Create a widget and place a button on the canvas
override the function “OnMouseButtonDoubleClick”
drag off the OnMouseButtonDoubleClick and place a print string,
connect to return node and place a “handled” on the return value
save, compile, hit play

double left click, nothing
double right click or double middle mouse click and you WILL get the text.

It seems to be only on the left mouse button that there is an issue.

It’s working as intended. There’s no default double-click for buttons. At the moment you are overriding *OnMouseButtonDoubleClick *for the canvas the button is sitting on.

Make the canvas/parent container visible and double click anywhere but the button. You’ll see that the double-click works just fine.
When you left-click the button, it handles it as a single click; it will not allow you to click through and hit the canvas underneath.

Since there’s no default RMB button behaviour (not very intuitive to start with), the RMB on the button clicks through to the canvas unhandled by the button, allowing second click to connect with the underlying canvas as well.

You can use PreciseClick to click through a button - expand the Interaction tab of the button widget and change Click Method to PreciseClick. Still, this does not mean that the button is double-clicked, you’ll be hitting whatever is underneath it, which is fine if that’s what you’re after. The button is purely visual at this point.

I admit I did not watch the tutorial but you’re clearly tackling inventory here. Every slot will be a separate double-clickable widget with an image to show the item + tooltip. I wouldn’t use canvas & button for this - it will work, but it’s not very performant.
You can achieve an elegant result with:

[Overlay] (if you want to add text later, like a counter for example )
[Border]
[INDENT][Image][/INDENT]

It will be more work, though, as buttons have that nice click-in - click-out behaviour, hover modes and so on. Stick with what works best for you.
Border has an in-built default double click event, btw.

Thankyou so much for the advice Everynone. It’s really appreciated.

Ill give your method a shot and see how it comes out.
What is really baffling me is that it works fine in the tutorial, which is on an older version of UE4. Hence my assumption that it was a bug.

Again, massive thanks for the response.

Edit: and yes, it’s an inventory system. :slight_smile:

You can stick with what you have for now, just make sure you enable PreciseClick for the button. Refactoring code for optimisation can (and in most cases should) be done at a later stage. If you’re not going to have 100+ inventory buttons on screen at a time, the performance impact might be negligible unless you target low spec/mobile. Good luck!

Oh if only it were that simple. :), in my main project it is already set to precise click and tap.

I think you might be experiencing what Nick was concerned about in his post.

So, essentially you need a widget that reacts to single RMB and a double LMB?
That should be pretty straightforward with a border. If you also need to handle a single LMB, you can, but it will most likely fire during double click event, too.

At the moment the intended use is as follows:
Lmb (down-held) drag item to another slot
Lmb (double clicked) use item
Rmb (Clicked) Spawns another widget which allows you to use, destroy etc the item

There is no left click (Up-Down) functionality.

Tbh im thinking of redoing the system entirely so i have this instead.
Lmb (clicked-held) drag item to another slot
Shift+Lmb (clicked (up-down)) use item
Rmb (Clicked (up-down) Spawns another widget which allows you to use, destroy etc the item

I think this will simplify the system considerably. it’s not over intuitive but it’ll work i think.
Firstly though, I’ll try doing it with a border. Even though what I’m working on is for PC i still want it as optimized as humanly (or computationally) as possible. :slight_smile:

Hey, I think that one missing piece of information that is crucially missing here is that this worked OK in 4.16 but stopped working after update to 4.17. Everything else is correct what you said, this is not a button function but the Slate function that is being overridden. How it worked before was that BOTH events were triggered, the button On Clicked(or mouse button down or whatever else) and the parent event of OnMouseButtonDown, or in this case OnMouseButtonDoubleClick were triggered. Now the Button widget does consume the mouse events and the “parent” events are not triggered. If you set the button as disabled the parent events work ofcourse.

1 Like

I actually tested this in 4.16.3 and the issue was still there.

Just to Update this once again, I got this working beautifully using everynone’s method.

Replace the button with a border.
Replace the button references in the graph with the border equivalent (set brush instead of set style)
Create 2 more function overrides for “on mouse enter” and “On mouse leave” and set the brush to the hovered and default

That’s pretty much it. Really appreciate the help everyone.

Yes that solution does work(more like a workaround btw).

Little thought experiment, it did not work for you, but the guy making the tutorial you are referencing does have it working on the older version of the engine => it worked before 4.17 and if what you are saying is true, which I suppose it is, he is on 4.16.2 or older. I am pretty sure that my OnMouseButtonDown did work with the button being present in the widget before my update to 4.17, unfortunately I am not sure which version of Engine I was using before as I do need to compile them from source and the update is not that easy so I do not do it very often:).

I belive issue here is that On Mouse Button Down blueprint function override does not fire at all for left mouse button in 4.17. It is working fine for right mouse button and was working with left mouse button too in 4.16.

From my experience, it has always worked and still works fine. Hook up a PrintString node to *onMouseButtonUp *and onMouseButtonDown and see for yourself.
The only issue we had here was a *ButtonWidget *consuming input.

edit:

Maybe I misunderstood something but this stuff works fine. What is the exact problem you’re having?

Then it is regression as this function was firing for left button too in all previous versions, button was not blocking it before. Also, my button is set to precise click.

On Mouse Button Down was firing for left button too in 4.16 and now it does not. I am curious if it is feature or bug.

Here is my setup:

To boil the whole thing down to a single sentence: With LMB, you want to drag a widget containing a clickable button widget, right?

If PreciseClick no longer works, you can always use onPreviewMouseButtonDown instead, it will work with both LMB and RMB.
But then you will just have to deal with button styles - the reason why I abandoned buttons when dragging (and never looked back!).

Okay, I understand I am just confused about the silent change between versions. Well, I found out another thing which can be connected to this change. IsHovered() returns false for widgets containing button when right mouse is clicked. I belive that right clicking does not change anything on fact, that mouse is still on widget, so it should be still true. We probably need to have IsDirectlyHovered() function to be exposed to blueprints, that one works correctly.

So, is this a bug or a intended behavior? I want to know before i rework my stuff