Are there some ways to Handle Right Mouse Click in UMG Button?

Are there some ways to Handle Right Mouse Click in UMG Button?
OnClicked Delegate only fires when Left Mouse Button Click. I can not find a properly way to handle the Right Mouse Button Click.

Hope Epic will add OnRightClick event to UMG button.

I think I should inherit the UButton class and to see if I could add OnRightClick Delegate.

The real problem is SButton does not handle right mouse click.
I have to rewrite some methods in SButton.
In true word, I don’t want to duplicate and mess up the codes. But the UMG and Slate UI are really not that flexible and easily extendable. I have no choice but to finish the work.

No - buttons are almost never right clickable except for in a few cases I’ve seen in other applications, all of which are bad UX decisions because it’s a control people don’t expect to be right clickable. So we didn’t design the standard button widget to support that behavior. Inheriting from UButton won’t solve it either, you’d need to implement a new slate widget with that functionality. If you just need to detect right mouse button down and up, that’s achievable with the overridable functions on all user widgets. With that you can make your own right clickable button widget.

Thank you.
I already got it. I must duplicate many codes with SButton and UButton and add some functionalities of right mouse button.

OK, I keep bouncing my way to this post and I can no longer resist commenting. It’s a bad UX decision because it’s control people don’t expect to be right clickable? Seriously? Do you use Windows? Especially the most recent versions? There is this thing called a “Start Button” It’s right clickable. The left button in UI/UX is defined as the default option for a clickable target. The right buttons is a context selector for the other options that are available for the same target. Right buttons have existed on computer mice for decades. People are used to them. They allow the UI/UX designer to expand the user choices without adding items to the limited real estate of the computer screen. Yeah, I guess taking up more real estate is a GREAT design decision (sarcasm). In complex games like MMOs the number of controls and options available to the user is large and the user’s expections about having said controls quickly accessed are strong. Context based controls are vital. In a shooter game? Yeah, left click only buttons are normal and ARE expected to be that way by the user but that is not a reasonable assumption for all applications.


Sorry for the necro, but … holy hell this is dumb.

“We didn’t add right click events because we thought right click was bad UX design”

… what?

Regardless of how you feel about what does / does not constitute a “good” UX decision , that’s entirely up to the developer and what they want to do with their software.

bad UI tool design is removing choice from developers, good UI tool design is providing the widest range of options you can (within reason).


Two line change to “fix” it.

Lines 226 and 272 in SButton.cpp (UE 4.24) - obviously this will affect all buttons accross the entire UE4 editor and project. Something I doubt you’ll want, but nevertheless.

Hi, Thank you for explain.
How about make a parameter for click events which contains click button (left or right).
It may be usefull for: left button for action, right for some help tooltip or action menu.

simple, bind a on hovered event and on unhovered event to your button that enable and disable a boolean. Then add an overide for “on mouse button up” in your widget function and have it check if the boolean is active and from the mouse event call “get effecting button” and check if it equals the right mouse button, if it is you can call a event in your event graph that handles your button logic



Overwrite OnMouseButtonDown in your widget, from the MouseEvent (FPointerEvent) input [
GetEffectingButton. You will now have the FKey that was pressed down, check if FKEY == FKey::RightMouseButton. Now you can call a custom function or the OnClick to handle what you want to do after the mouse button was clicked.