How to trigger a mouse event by long-pressing a widget?

How can I branch an event based on the length of time a click is held on a widget?

I want a standard click to display information, while a long press initiates dragging. However, an EventReply is required to initiate the drag, and I haven’t found a way to delay this input. Because it cannot be called from an event, nor can the function contain a Delay.

Is there any way to bridge these gaps in functionality?

yea you cant Delay inside OnMouseButtonDown since it has to return EventReply right away. return Handled immediately and sort click vs drag with a timer.

on Pressed store time + SetTimerByFunctionName 0.4s that sets bLongPress=true and calls DetectDragIfPressed. on Released clear the timer, if bLongPress still false do your click info logic, else finish drag.

you need OnDragDetected overriden with Create DragDropOperation in it, plus OnDragCancelled to reset the flag or it sticks. 0.4-0.5s feels right.

How to make the logic for “on Released clear the timer”? OnMouseButtonUp is doesn’t working at all.

OnMouseButtonUp not firing at all is the same pointer-capture family as the OnMouseMove issue, just from the other side. check which of these is eating it:

  1. a drag started, so the release became the drop. if DetectDragIfPressed fired during your long press and Create DragDropOperation ran, the system is no longer in a “press” state — it is in a drag state. the mouse-up is consumed as the drop: it shows up in OnDrop (if released over a widget that handles it) or OnDragCancelled (released anywhere else). that is why OnMouseButtonUp never runs. in your long-press flow, “user let go” during the drag belongs in OnDragCancelled / OnDrop, not OnMouseButtonUp. reset bLongPress and clear the timer in both.
  2. no drag involved and the up never arrives: make sure OnMouseButtonDown returns Handled. if the down returns Unhandled, your widget never owns the pointer, and the up event can be offered to whatever is under the cursor instead of you.
  3. an invisible overlay is stealing the release: a container or background image with hit-test enabled above your widget. in the UMG designer turn on the hit-test visibility debug (Show → Debug Widget… or set the overlay to Not Hit Test Invisible) and see who owns the pointer on release.
    practical shape for the whole flow: Pressed → store time, Set Timer 0.4s, return Handled. Timer fires → bLongPress = true, DetectDrag. Released path: if a drag is running, handle end-of-drag in OnDragCancelled/OnDrop (clear timer, reset flag). if no drag, OnMouseButtonUp runs — clear the timer, check bLongPress to decide long-press vs click. if OnMouseButtonUp still never fires with no drag started, it is case 3.