Download

4.16 How to disable UMG scrollbox right click/drag function? (solved)

I made a simple inventory UI using UMG scroll-box.

I can scroll and click items on the scroll-box without any problem.

However, I would like to disable the right mouse click and drag function on the scroll-box.

I’ve tried to override EventOnDragEnter / OnDragOver / OnDragDetected but there is no use, the right mouse click/drag function keeps interacting with my scroll-box.

Is there any way to disable the right mouse click/drag function for scroll-box?

Thank you.

I believe there is no way to do it without digging into Slate. Scrollbox is not as flexible as it should be.
If it’s a gamebreaker, you could create your own custom scrollbox.

Depending on what you have in your scroll box (if it’s another Widget item that you’ve created) I believe you can try detecting drag in that class, (using rmb instead of lmb) but just have it not do anything, that way drag input is focused on the object in the scrollbox, rather than the scrollbox itself.

Hi!

I dug into the SScrollbox.cpp in source code, found out the right mouse drag and click function and changed it accordingly.

And it worked!

(In PIE and packaged game, right mouse click and drag no longer interfering with my scroll-box, cursor, and I don’t have to tolerate that stupid grabbing icon any more!)

Simply return the function with Unhandled() works for me!

Thank you for your advice :smiley:

Hi,I have a question is that How to change the right mouse click to left mouse click?

Hi, Sorry for the super late reply.

The functions that I changed are these two:

bool SScrollBox::IsRightClickScrolling() const

FReply SScrollBox::OnMouseButtonDown( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )

It’s just for turning off right mouse interaction.

If you want to switch from right mouse to left mouse, then I think you need to modify other functions in the SScrollbox.cpp as well.