Manually scroll on UMG Scroll Box

Hello, is there any method to manually scroll up or down with a key (for example PgUp or PgDown) with an UMG Scrollbox? I tried to search a function to do that, but I haven’t found anything useful.

You can call Set Scroll Offset.


There’s a couple of other elements you’d need to take into account, though:

  • if you wish the widget to intercept the keypress, it needs to be Keyboard Focusable, be in focus, and overriding onKeyDown / Up
  • the scroll box needs to be exposed as variable
  • if it’s the Player Controller / Pawn (wherever you handle input) calling the shots, you can ignore the 1st bullet point
1 Like

Yeah, it works, thank you! But there’s a way to trigger OnKeyDown when it’s focused a text box and the user is writing for example?

Hm, interesting question, actually.

I’m assuming you’ve tried and it’s not working. If it’s not, it must be the text box consuming key input, which is probably beyond what UMG can natively override - it does have limitations / some functionality is not exposed.

There is one thing you could try - treat the text box as a visual element only and handle everything in the Player Controller. Essentially, use Any Key, accumulate text it in a string variable and then send it to the text box. This will allow you to intercept pretty much anything you want. Probably not ideal but should work.

The only (?) downside is that you’ll most likely miss out on the blinking caret.

Your PC could handle the key input and send the relevant key to the widget like so:

And have the widget interpret it:

This is quite hacky and completely untested but should allow you to handle any input.

As far as I know the input gets consumed at the text box level so nothing else can handle it. You’d need to rewrite the widget in Slate.

Also, Page Up / Down does some strange things to the caret - not sure what the deal is here.

Unfortunately I’m in UI only input mode, so the commands coming from Player Controller won’t work.