I have a strange bug I’m wondering if someone can shed any light on. Some of the scroll boxes in my game require an extra click to function the sroll bar can’t be clicked and dragged until it has been clicked on at least once.
Through some experimentation I’ve narrowed his down to when the UI that contains them is added to the players screen. I have a C++ PlayerController, in its SetupIntpuComponent() it binds an Onclick method:
If I add the Widget in the PlayerController’s Tick() method, the scrollbar within the dummy widget requires an extra click before scrolling is possible. If I add the Widget in the OnClick() method (which fires when I click on the background in the game) the scroll boxes work perfectly.
Thoughts? Can anyone see why these would behave differently or what I shouild be doing to avoid this problem?
I work with blueprints and I have the same problem.
The problem is that the scrollbar (Scroll Box element) is not a focusable element but SHOULD BE focusable like buttons or input fields, because if you click on a focusable element, it takes focus, and then click on a non-focusable element, the click event will not occur (the focus will simply be removed from the previous one)
This is a big problem if we want to combine focusable elements (Buttons, input fields, they have the option: “Is Focusable”) and non-focusable ones (pictures, borders, text)
I found a temporary solution - a crutch:
You can surround the scrollbar with invisible buttons, but which have a defined logic for the hover event (the option “is Variable” must be enabled) and when hovering on these buttons (run the “Set Focus” function on the “Scroll Box” element)
PS Of course, you will get a warning in the console that you cannot set focus to a non-focusable element, but we do not need this - we needed to remove focus from the previous element, which is what happens!