The SWidget::OnMouseButtonUp seems to trigger only after a double click, not a simple one.
To repro, override this function, for example:
// SYagHUDWidget inherits from SCompoundWidget
FReply SYagHUDWidget::OnMouseButtonUp(const FGeometry & MyGeometry, const FPointerEvent & MouseEvent)
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("OnMouseButtonUp"));
The message appears only when double clicking.
Whatever widget you would like to have use the OnMouseUp override will need to capture the mouse in order for this to work correctly. The reason for this is that the mouse is already captured by something else, which is most likely the viewport.
Have a great day,
Thank you for you fast answer and my apologies for my delayed reaction, i was away.
I did try to suppress the viewport capture, but with no success:
UGameViewportClient* Viewport = GEngine->GameViewport;
Is that the correct way to do this ?
Take a look at the WidgetBlueprintLibrary.cpp file, as this contains examples of how to properly capture the mouse as well as many other functions that are related to widgets. What you’re doing is telling the viewport not to capture the mouse, but you also have to ensure that your widget knows to capture the mouse.